wildcard on a input box query

L

Linda

I am running a parameter query off of a command button on a form. I am using
an input box to get the parameter. How can I modify the code below so I can
use a wildcard with the value passed? - example if I only remember the first
few of the document number and want to see all documents that start with it.

Private Sub cmdLUOblDocNum_Click()
'* run a query by specific document number
'* Document Number must be completely spelled out
Dim strDocNum As String
Dim strFilter As String
Dim strFormName As String
strDocNum = InputBox("Enter a Document Number", "Document Number Lookup
- Obligation")
strFilter = "[document number]= '" & strDocNum & "'"
strFormName = "dstOblig"
DoCmd.OpenForm strFormName, acFormDS, , [strFilter], acFormEdit,
acWindowNormal
End Sub
 
D

Douglas J. Steele

strFilter = "[document number] Like '" & strDocNum & "*'"

if it has to start with what you typed

strFilter = "[document number] Like '*" & strDocNum & "*'"

if what you typed can appear anywhere.
 

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

Top