S
Scott
Hi all,
I'll ask a question first, then give the explanation of what I'm
trying to do if that's not enough info, and then ask the question again.
Is there a way to check the 'referring' form that called the 'OpenForm'
command?
I have a problem where I have one form (Lets call it 'frm_data_entry') which
is opened from two other forms. This first of these forms is basically a
Main menu, and when I have the user click a button it opens the data entry
form, makes it fill the screen, and goes to a new record for them to start
inputting data. I do this simply with the following:
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
DoCmd.GoToRecord , , acNewRec
End Sub
My problem is, I have another 'Search' form which runs some filters for
searching, and lists limited information of appropriate records, which the
user can then double-click on to open the 'frm_data_entry' to see the all of
the information for that record. Trouble is, when I use the following code
on the 'search' form:
Private Sub goto_Click()
On Error GoTo Err_goto_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_data_entry"
stLinkCriteria = "[mash_ID]=" & Me![mash_ID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_goto_Click:
Exit Sub
Err_goto_Click:
MsgBox Err.Description
Resume Exit_goto_Click
End Sub
- it opens the 'frm_data_entry' form at the apprpriate entry, and then runs
the
DoCmd.GoToRecord , , acNewRec
in the 'Form Open' and goes to the blank record.
Is there a way to check the 'referring' form that called the 'OpenForm'
command, and then use an If statement to decide whether or not the
'acNewRec' command should be used?
Any help would be greatly appreciated
Thanks in advance
Scott Palmer
I'll ask a question first, then give the explanation of what I'm
trying to do if that's not enough info, and then ask the question again.
Is there a way to check the 'referring' form that called the 'OpenForm'
command?
I have a problem where I have one form (Lets call it 'frm_data_entry') which
is opened from two other forms. This first of these forms is basically a
Main menu, and when I have the user click a button it opens the data entry
form, makes it fill the screen, and goes to a new record for them to start
inputting data. I do this simply with the following:
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
DoCmd.GoToRecord , , acNewRec
End Sub
My problem is, I have another 'Search' form which runs some filters for
searching, and lists limited information of appropriate records, which the
user can then double-click on to open the 'frm_data_entry' to see the all of
the information for that record. Trouble is, when I use the following code
on the 'search' form:
Private Sub goto_Click()
On Error GoTo Err_goto_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_data_entry"
stLinkCriteria = "[mash_ID]=" & Me![mash_ID]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_goto_Click:
Exit Sub
Err_goto_Click:
MsgBox Err.Description
Resume Exit_goto_Click
End Sub
- it opens the 'frm_data_entry' form at the apprpriate entry, and then runs
the
DoCmd.GoToRecord , , acNewRec
in the 'Form Open' and goes to the blank record.
Is there a way to check the 'referring' form that called the 'OpenForm'
command, and then use an If statement to decide whether or not the
'acNewRec' command should be used?
Any help would be greatly appreciated
Thanks in advance
Scott Palmer