|
Below is the event procedure that I have on the button.
On clicking the command10 button the form is opened with corresponding record matching the “CASNumber” (just like an id) which is entered by the user in the Text0 (text box). CASNumber is a user input which is compared against the field CASNumber in the table (DHSTable). Instead of opening the form with the corresponding record if there is a match, I just want to add another text box in my form and when the user enters a “CASNumber” in text0 – text box and clicks the command button, I want this new text box to just display if it found the record or not in the table(DHSTable).
Private Sub Command10_Click() On Error GoTo Err_Command10_Click
Dim stDocName As String Dim stLinkCriteria As String stDocName = "DHSForm" stLinkCriteria = "[CASNumber]=" & "'" & Me![Text0] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command10_Click:
Exit Sub
Err_Command10_Click: MsgBox Err.Description Resume Exit_Command10_Click End Sub
Thanks a lot for your help!
|