Modify VBA code so user can use wild cars to input

Posted on 2012-08-13
Last Modified: 2012-08-13
Is there any way to modify code in the form: line

stLinkCriteria = "[ACCTNO] = [Enter Loan Number]" so user can use wild cads to input.

Purpose of the question: Loan Number being inputted in the format

I would like to modify code so if user by typing in the box "*123456*" should be able to retrieve loan information instead of typing full loan number.
See attached screen shots for your reference

Private Sub cmdIndLoan_Click()
On Error GoTo Err_cmdIndLoan_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Financial-Table form"
    stLinkCriteria = "[ACCTNO] = [Enter Loan Number]"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit Sub

    MsgBox Err.Description
    Resume Exit_cmdIndLoan_Click
End Sub

Open in new window

Question by:maximyshka
    LVL 61

    Accepted Solution

    Try this:

    stLinkCriteria = "[ACCTNO] LIKE  '*' & [Enter Loan Number] & '*'"

    Open in new window


    Author Comment

    Thank you very much!!!
    LVL 61

    Expert Comment

    You're welcome!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now