I erroneously post the following to the Alpha 5 Verson 4 phorum, so thought that I would try it here as I still am having the problem.
***********************************************************
Date: 07-22-2003 7:56 PM
File:
We recently switched from A5V4 single user to A5V5 multi users.
One of my forms is an invoice as the parent record and payments as the children (one-to-many). The child table is linked to the parent via (invoice_number+payment_date).
The child records are displayed on the form as a browse with 4 fields for the: payment date, payment amount, a single charactor indicating payment type and a 30 character description field.
The user has the ability to add, change and delete payment records. The normal mode is to open the form from the menu screen, find the invoice by key using invoice number, enter a new payment record and then close the form and return to the menu using a return button. The payment records are being created correctly, but we are getting a blank payment record created (with the appropriate invoice linking key).
I can duplicated the situation in a single user environment. I found that if I press the enter key after typing in the description, I usually get the blank payment record along with the valid payment record. I found that if I do not press the enter key after typing the description, but click on the "return button" (close form) the correct payment record is created with no blank record.
Thanks for any help
**********************************************************
Msg ID: 70027
Subject: RE: blank records in child table
Author: Tom Cone Jr
Date: 07-22-2003 8:47 PM
File:
Charlie,
Watch the cursor after you press the ENTER key at the end of the Description field.
I'll bet that it drops down one row and you begin a new record, which is then saved when you shift focus outside the browse object. You might put a cancel() in the CanSaveRecord event field rule for the table if a key field is empty. Or you might restrict enters each time a new record is saved (causing the user to push a button to begin a new record by releasing the restriction...) There are probably other ways to do it if these are suitable ...
**********************************************************
Msg ID: 70029
Subject: RE: blank records in child table
Author: Charlie Johnson
Date: 07-23-2003 6:43 AM
File:
Yes Tom that is what is happening. I would like to follow your suggestion to use a cancel() in the cansaverecord event if there is no date input, but can not figure out how to do it.
***********************************************************
Msg ID: 70032
Subject: RE: blank records in child table
Author: Tom Cone Jr
Date: 07-23-2003 7:28 AM
File:
If len(trim(dtos(your_date_field_name))) = 0 then
cancel()
end if
-- tom
************************************************************
Msg ID: 70050
Subject: RE: blank records in child table
Author: Charlie Johnson
Date: 07-24-2003 12:45 PM
File:
The following code in the cansaverecord event field rule did not solve my problem.
If len(trim(dtos(my_date_field))) = 0 then
cancel()
end if
I placed a calculated field on my form to monitor the length parameter of the date in my child records.
As you correctly surmised, when the user hits the enter key after typing in the last field of the record (description) the curser drops down to the beginning field of the next record (date) which would be the next new record if one was desired. The calculated length shown on my form still has an 8 which would be the length of the date from the previous valid record. I found that if I move the curser up to a valid record and then back down to the blank, the length value on the screen becomes 0.
This software has been in place since January 2000 using A5V4 without this problem, so it has to be related to changing to A5V5.
This is the code that is in my close/return button
dim mode as c
mode = parentform.mode_get()
if mode = "ENTER" .or. mode = "CHANGE" then
parentform.commit()
if parentform.mode_get()"VIEW" then
ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
end if
end if
parentform.close()
Thanks
Charlie
***********************************************************
Date: 07-22-2003 7:56 PM
File:
We recently switched from A5V4 single user to A5V5 multi users.
One of my forms is an invoice as the parent record and payments as the children (one-to-many). The child table is linked to the parent via (invoice_number+payment_date).
The child records are displayed on the form as a browse with 4 fields for the: payment date, payment amount, a single charactor indicating payment type and a 30 character description field.
The user has the ability to add, change and delete payment records. The normal mode is to open the form from the menu screen, find the invoice by key using invoice number, enter a new payment record and then close the form and return to the menu using a return button. The payment records are being created correctly, but we are getting a blank payment record created (with the appropriate invoice linking key).
I can duplicated the situation in a single user environment. I found that if I press the enter key after typing in the description, I usually get the blank payment record along with the valid payment record. I found that if I do not press the enter key after typing the description, but click on the "return button" (close form) the correct payment record is created with no blank record.
Thanks for any help
**********************************************************
Msg ID: 70027
Subject: RE: blank records in child table
Author: Tom Cone Jr
Date: 07-22-2003 8:47 PM
File:
Charlie,
Watch the cursor after you press the ENTER key at the end of the Description field.
I'll bet that it drops down one row and you begin a new record, which is then saved when you shift focus outside the browse object. You might put a cancel() in the CanSaveRecord event field rule for the table if a key field is empty. Or you might restrict enters each time a new record is saved (causing the user to push a button to begin a new record by releasing the restriction...) There are probably other ways to do it if these are suitable ...
**********************************************************
Msg ID: 70029
Subject: RE: blank records in child table
Author: Charlie Johnson
Date: 07-23-2003 6:43 AM
File:
Yes Tom that is what is happening. I would like to follow your suggestion to use a cancel() in the cansaverecord event if there is no date input, but can not figure out how to do it.
***********************************************************
Msg ID: 70032
Subject: RE: blank records in child table
Author: Tom Cone Jr
Date: 07-23-2003 7:28 AM
File:
If len(trim(dtos(your_date_field_name))) = 0 then
cancel()
end if
-- tom
************************************************************
Msg ID: 70050
Subject: RE: blank records in child table
Author: Charlie Johnson
Date: 07-24-2003 12:45 PM
File:
The following code in the cansaverecord event field rule did not solve my problem.
If len(trim(dtos(my_date_field))) = 0 then
cancel()
end if
I placed a calculated field on my form to monitor the length parameter of the date in my child records.
As you correctly surmised, when the user hits the enter key after typing in the last field of the record (description) the curser drops down to the beginning field of the next record (date) which would be the next new record if one was desired. The calculated length shown on my form still has an 8 which would be the length of the date from the previous valid record. I found that if I move the curser up to a valid record and then back down to the blank, the length value on the screen becomes 0.
This software has been in place since January 2000 using A5V4 without this problem, so it has to be related to changing to A5V5.
This is the code that is in my close/return button
dim mode as c
mode = parentform.mode_get()
if mode = "ENTER" .or. mode = "CHANGE" then
parentform.commit()
if parentform.mode_get()"VIEW" then
ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
end if
end if
parentform.close()
Thanks
Charlie