Using a wildcard to open a form

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi all…I would like to use a wildcard in below code.
By entering ie “Ap†in [Apples] I would like to find all Apples
Apples green, Apples yellow etc etc. The target form is a continous form..

Thanks!


Private Sub_FindApplesMenu_Click()
On Error GoTo Err_Find ApplesMenu_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Fruits"

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

Exit_FindApples_Click:
Exit Sub

Err_FindApplesMenuClick:
MsgBox Err.Description
Resume Exit_FindApplesMenuClick

End Sub
 
Thank you Douglas!

Douglas J. Steele said:
stLinkCriteria = "[Apples] Like '" & Me![Apples] & "*'"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Peter said:
Hi all.I would like to use a wildcard in below code.
By entering ie "Ap" in [Apples] I would like to find all Apples
Apples green, Apples yellow etc etc. The target form is a continous form..

Thanks!


Private Sub_FindApplesMenu_Click()
On Error GoTo Err_Find ApplesMenu_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Fruits"

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

Exit_FindApples_Click:
Exit Sub

Err_FindApplesMenuClick:
MsgBox Err.Description
Resume Exit_FindApplesMenuClick

End Sub
 
Back
Top