G
Guest
Hello, I'm trying to write a search form that will search a main form for
fields. The main form consists of several of several subforms. The following
piece of code successfully searches for the Buyer Field on the main field.
Private Sub cmdSearchBuyer_Click()
Dim stbuyernumber As String
Dim stDocName As String
Dim stLinkCriteria As String
stbuyernumber = InputBox("Enter Buyer Number", "Search Buyer Number")
If stbuyernumber <> "" Then
stDocName = "frmMain2"
stLinkCriteria = "[tblBuyer].[BuyerNum] = " & stbuyernumber
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmSearch"
End If
A buyer can have many emails. I have an EMAIL subform that is linked to the
BUYER mainform. I want to search for the primary key of the email subform
(EmailID) so that it brings up the appropriate parent buyer number. Is there
a way to adjust this line in the code so it does that?
"stLinkCriteria = "[tblBuyer].[BuyerNum] = " & stbuyernumber"
Thanks!
End Sub
fields. The main form consists of several of several subforms. The following
piece of code successfully searches for the Buyer Field on the main field.
Private Sub cmdSearchBuyer_Click()
Dim stbuyernumber As String
Dim stDocName As String
Dim stLinkCriteria As String
stbuyernumber = InputBox("Enter Buyer Number", "Search Buyer Number")
If stbuyernumber <> "" Then
stDocName = "frmMain2"
stLinkCriteria = "[tblBuyer].[BuyerNum] = " & stbuyernumber
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmSearch"
End If
A buyer can have many emails. I have an EMAIL subform that is linked to the
BUYER mainform. I want to search for the primary key of the email subform
(EmailID) so that it brings up the appropriate parent buyer number. Is there
a way to adjust this line in the code so it does that?
"stLinkCriteria = "[tblBuyer].[BuyerNum] = " & stbuyernumber"
Thanks!
End Sub