M
Maggie
I have a form that opens when the database opens. The
user must type in their HRID into an unbound field and
then click a button to look up their records.
This works great as long as there is a match on the
subform. It pulls up the correct records but when there
isn't a match it starts a new set of records. If the HRID
doesn't match any records on the underlying subform I want
it to come back with an error message and not allow input.
Here is the code on the on click event procedure
Private Sub HRIDCMDBUTTON_Click()
On Error GoTo Err_HRIDCMDBUTTON_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sample"
stLinkCriteria = "[HRID]=" & "'" & Me![HRID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_HRIDCMDBUTTON_Click:
Exit Sub
Err_HRIDCMDBUTTON_Click:
MsgBox Err.Description
Resume Exit_HRIDCMDBUTTON_Click
End Sub
also - how do I make my initial form maximize so that a
user must input a valid HRID inorder to get to the subform.
Thanks in advance for any help!!
Maggie
user must type in their HRID into an unbound field and
then click a button to look up their records.
This works great as long as there is a match on the
subform. It pulls up the correct records but when there
isn't a match it starts a new set of records. If the HRID
doesn't match any records on the underlying subform I want
it to come back with an error message and not allow input.
Here is the code on the on click event procedure
Private Sub HRIDCMDBUTTON_Click()
On Error GoTo Err_HRIDCMDBUTTON_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sample"
stLinkCriteria = "[HRID]=" & "'" & Me![HRID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_HRIDCMDBUTTON_Click:
Exit Sub
Err_HRIDCMDBUTTON_Click:
MsgBox Err.Description
Resume Exit_HRIDCMDBUTTON_Click
End Sub
also - how do I make my initial form maximize so that a
user must input a valid HRID inorder to get to the subform.
Thanks in advance for any help!!
Maggie