I have a database that catalogues my stamp collection. My problem is that I want to return to the last record I had displayed when last I Closed Access down. I have set a marker in the "Country" table, called LPOS, and a marker in a related table "StampCatalogue", called MPOS. Both are set to "Y" on close, and reset to "N" when the record is subsequently opened and found
I use the Load event on the Main Form to automatically return me to the last country (MPOS) that I had loaded. I then want to return to the last stamp I had displayed for that country (LPOS). I cannot automate this part of the function. The code will run as a stand alone but not as part of the initial Load event.
By using the following code (I have removed other, irrelevant, sections of code for clarity) I can automatically find the country
Private Sub Form_Load()
' set the field to search on
DoCmd.GoToControl "LPos" 'Absolute address is Forms!Country!LPos
DoCmd.FindRecord "Y", acEntire, True, acSearchAll, True, acCurrent, True
' clear flag
Me!LPos.Text = "N"
But I run into trouble when I then want to find the data in the subform
I've tried all sorts but can only execute the following as a seperate routine after the first one has completed
' find record in subform
Forms!Country!StampCatalogueSubform!Mpos.SetFocus
DoCmd.FindRecord "Y", acEntire, True, acSearchAll, True, acCurrent, True
Forms!Country!StampCatalogueSubform!Mpos.Text = "N"
How can I make the search on the subform run as part of the initial load event? I have:
a) included it as part of the Code
b) called it as a sub routine from the load event
c)placed it in the Load event of the SubForm
d)I've even tried the Activate event to no avail.
Help! Please, thanks in advance, Leigh
I use the Load event on the Main Form to automatically return me to the last country (MPOS) that I had loaded. I then want to return to the last stamp I had displayed for that country (LPOS). I cannot automate this part of the function. The code will run as a stand alone but not as part of the initial Load event.
By using the following code (I have removed other, irrelevant, sections of code for clarity) I can automatically find the country
Private Sub Form_Load()
' set the field to search on
DoCmd.GoToControl "LPos" 'Absolute address is Forms!Country!LPos
DoCmd.FindRecord "Y", acEntire, True, acSearchAll, True, acCurrent, True
' clear flag
Me!LPos.Text = "N"
But I run into trouble when I then want to find the data in the subform
I've tried all sorts but can only execute the following as a seperate routine after the first one has completed
' find record in subform
Forms!Country!StampCatalogueSubform!Mpos.SetFocus
DoCmd.FindRecord "Y", acEntire, True, acSearchAll, True, acCurrent, True
Forms!Country!StampCatalogueSubform!Mpos.Text = "N"
How can I make the search on the subform run as part of the initial load event? I have:
a) included it as part of the Code
b) called it as a sub routine from the load event
c)placed it in the Load event of the SubForm
d)I've even tried the Activate event to no avail.
Help! Please, thanks in advance, Leigh