I have a main form named: frmCitationPicker that contains
a subform named: sfrmCitationDatasheet. There is a command button on the main form named: cmdAddNewCite. When this command button is clicked, it pops up another form named: sfrmCitations that allows the user to enter a new citation.
When the user closes sfrmCitations, they are back in the code below. Me!sfrmCitationDatasheet.Form.Requery requeries the subform sfrmCitationDatasheet whose recordsource is a query so that it will contain whatever new records the user entered in sfrmCitations.
This all works fine. The problem arises when I try to make the currently selected record be the citation they last selected. I have code that figures out the record number to go to but:
DoCmd.GoToRecord acDataQuery, "Forms!frmCitationPicker!sfrmCitationDatasheet.Form", acGoTo, ThisRecNum
gives an error that "The Object Forms!frmCitationPicker!sfrmCitationDatasheet.Form is not open."
Can anyone explain why I can't go to ThisRecNum and why the error arises?
Thanks!
dftjsn
Private Sub cmdAddNewCite_Click()
On Error GoTo Err_cmdAddNewCite_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sfrmCitations"
DoCmd.OpenForm stDocName, , , stLinkCriteria, ,
acDialog, "GoToNewRec"
Me!sfrmCitationDatasheet.Form.Requery
a subform named: sfrmCitationDatasheet. There is a command button on the main form named: cmdAddNewCite. When this command button is clicked, it pops up another form named: sfrmCitations that allows the user to enter a new citation.
When the user closes sfrmCitations, they are back in the code below. Me!sfrmCitationDatasheet.Form.Requery requeries the subform sfrmCitationDatasheet whose recordsource is a query so that it will contain whatever new records the user entered in sfrmCitations.
This all works fine. The problem arises when I try to make the currently selected record be the citation they last selected. I have code that figures out the record number to go to but:
DoCmd.GoToRecord acDataQuery, "Forms!frmCitationPicker!sfrmCitationDatasheet.Form", acGoTo, ThisRecNum
gives an error that "The Object Forms!frmCitationPicker!sfrmCitationDatasheet.Form is not open."
Can anyone explain why I can't go to ThisRecNum and why the error arises?
Thanks!
dftjsn
Private Sub cmdAddNewCite_Click()
On Error GoTo Err_cmdAddNewCite_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sfrmCitations"
DoCmd.OpenForm stDocName, , , stLinkCriteria, ,
acDialog, "GoToNewRec"
Me!sfrmCitationDatasheet.Form.Requery