search command



Hi there,

i have a form where i would like to use for search by two criterias: Lot# or
Part Number - these are two field in the table.
need help to add that to the code

Private Sub Command39_Click()

End Sub
Private Sub Command42_Click()
On Error GoTo Err_Command42_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Open Orders"

stLinkCriteria = "[PART NUMBER]=" & "'" & Me![PART NUMBER] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit Sub

MsgBox Err.Description
Resume Exit_Command42_Click

End Sub

Private Sub Command43_Click()
DoCmd.OpenForm "Search & Update"
End Sub

Douglas J. Steele

stLinkCriteria = "[PART NUMBER]='" & Me![PART NUMBER] & "' AND " & _
"[Lot#]='" & Me![Lot#] & "'"

Incidentally, you'd be well advised to get rid of the # in your field name
(as well as the spaces). Special characters cause more problems than they're

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question