oneeyedwilly
MIS
why is it you solve one problem and another one rears its ugly head?
here it is.....
I have a form which contains personal data and relates to table 1.
on the form there is a button to open a new form containing emegency contact numbers, this form links to a second table.
the forms are linked by personID.
In order for me to add a new person and insert their data in to table 1 before opening the second form, i used a save record bit of code on the onclick of the button i.e.
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
i then open the form and link them in the same procedure.
( i had to do this as a record had to exist in personal details table in order for a corresponding record to exist in the emergency details table, 2 tables linked by a 1 to 1 relationship, naughty i know ) this works great........
The problem i have occurs when i want to view the emergency details of a person that already exists; as the message 'the command or action "SaveRecord" isnt available now' and i dont progress to the form containing the emergency details.
how do i get around this. I am thinking of using an if statement to check to see if a record exists: i.e.
if record exists continue
else SaveRecord blah blah blah
but not sure what the code would be or how to do it
Please help?!?!?!
here it is.....
I have a form which contains personal data and relates to table 1.
on the form there is a button to open a new form containing emegency contact numbers, this form links to a second table.
the forms are linked by personID.
In order for me to add a new person and insert their data in to table 1 before opening the second form, i used a save record bit of code on the onclick of the button i.e.
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
i then open the form and link them in the same procedure.
( i had to do this as a record had to exist in personal details table in order for a corresponding record to exist in the emergency details table, 2 tables linked by a 1 to 1 relationship, naughty i know ) this works great........
The problem i have occurs when i want to view the emergency details of a person that already exists; as the message 'the command or action "SaveRecord" isnt available now' and i dont progress to the form containing the emergency details.
how do i get around this. I am thinking of using an if statement to check to see if a record exists: i.e.
if record exists continue
else SaveRecord blah blah blah
but not sure what the code would be or how to do it
Please help?!?!?!