Hi
On a form(withsubforms) I have created a cmd button to open a second form and display the full details from a table that relates to a particular field. I wish to use the field [company] in the original form [frmJobTracking] as the criterion for the record search in [tblSupplier] and display the result in the form [frmSupplier].
The wizard has created the following which almost works. It opens the form and filters the records but, doesn't show any records. I think that I may have to use the original text field as a string search, I just don't know how to modify my code to do it.
Could anyone help?
Private Sub cmdFindSupplier_Click()
On Error GoTo Err_cmdFindSupplier_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "forSupplier"
stLinkCriteria = "[Company]=" & "'" & Me![cboSupplier] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSupplier_Click:
Exit Sub
Err_cmdFindSupplier_Click:
MsgBox Err.Description
Resume Exit_cmdSupplier_Click
End Sub
Thanks in advance.
Steven811
On a form(withsubforms) I have created a cmd button to open a second form and display the full details from a table that relates to a particular field. I wish to use the field [company] in the original form [frmJobTracking] as the criterion for the record search in [tblSupplier] and display the result in the form [frmSupplier].
The wizard has created the following which almost works. It opens the form and filters the records but, doesn't show any records. I think that I may have to use the original text field as a string search, I just don't know how to modify my code to do it.
Could anyone help?
Private Sub cmdFindSupplier_Click()
On Error GoTo Err_cmdFindSupplier_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "forSupplier"
stLinkCriteria = "[Company]=" & "'" & Me![cboSupplier] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSupplier_Click:
Exit Sub
Err_cmdFindSupplier_Click:
MsgBox Err.Description
Resume Exit_cmdSupplier_Click
End Sub
Thanks in advance.
Steven811