I have a form with an embedded browse showing the names and titles of each contact at a given customer's office.
I am currently using an X-Dialog Box to add contacts and it is worling very well.
Now...I want to call an X-Dialog box when the contact information for a specific individual changes...maybe someone gets married and their name changes, maybe the user inadvertantly entered bad information when the contact was originally created.
I have created a new X-Dialog box with variables for each field in the contact record...Prefix, First Name, Last Name and so on.
I have coded the On_Fetch event of the browse to set these variables to information from the current record.
When I then cause the "Edit_Contact" X-Dialog box to activate, all of the proper information from current record is displayed.
When I change a bit of information within the X-Dialog box and then go look at the value of the variables, the variables properly show the new or updated information.
Next, I am attempting to wrie the changes to the proper record in the contacts table.
Here is the code I am using... Unfortunately, it is not working.
All suggestions are very welcome!
Thanks
Louis
__________________________________
'Open tbl_contacts and write new contact information to a new record then close tbl_contacts
t = table.open("tbl_contacts", FILE_RW_SHARED)
t.change_begin()
t.prefix = vc_edit_contact_prefix
t.first_name = vc_edit_contact_first
t.middle_name = vc_edit_contact_middle
t.last_name = vc_edit_contact_last
t.suffix = vc_edit_contact_suffix
t.Title = vc_edit_contact_title
t.change_end(.T.)
t.close()
'Refresh data in Form 'Customer_View' at parent level.
DIM object_name as C
object_name = ":"+"Customer_View"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
'Can only resynch data in View mode, so save record first to be sure that layout is in View mode.
varP_Object.Commit()
varP_Object.Resynch()
varP_Object.Refresh_Layout()
end if
_________________________________________
I am currently using an X-Dialog Box to add contacts and it is worling very well.
Now...I want to call an X-Dialog box when the contact information for a specific individual changes...maybe someone gets married and their name changes, maybe the user inadvertantly entered bad information when the contact was originally created.
I have created a new X-Dialog box with variables for each field in the contact record...Prefix, First Name, Last Name and so on.
I have coded the On_Fetch event of the browse to set these variables to information from the current record.
When I then cause the "Edit_Contact" X-Dialog box to activate, all of the proper information from current record is displayed.
When I change a bit of information within the X-Dialog box and then go look at the value of the variables, the variables properly show the new or updated information.
Next, I am attempting to wrie the changes to the proper record in the contacts table.
Here is the code I am using... Unfortunately, it is not working.
All suggestions are very welcome!
Thanks
Louis
__________________________________
'Open tbl_contacts and write new contact information to a new record then close tbl_contacts
t = table.open("tbl_contacts", FILE_RW_SHARED)
t.change_begin()
t.prefix = vc_edit_contact_prefix
t.first_name = vc_edit_contact_first
t.middle_name = vc_edit_contact_middle
t.last_name = vc_edit_contact_last
t.suffix = vc_edit_contact_suffix
t.Title = vc_edit_contact_title
t.change_end(.T.)
t.close()
'Refresh data in Form 'Customer_View' at parent level.
DIM object_name as C
object_name = ":"+"Customer_View"
DIM varP_Object as p
'Get a pointer to the specified object
varP_Object = obj(object_name)
'Check if the specified object exists
if .not. is_object(varP_Object) then
ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
else
'Can only resynch data in View mode, so save record first to be sure that layout is in View mode.
varP_Object.Commit()
varP_Object.Resynch()
varP_Object.Refresh_Layout()
end if
_________________________________________
Comment