• Modify code (Access 2003)

    • This topic has 3 replies, 2 voices, and was last updated 17 years ago.
    Author
    Topic
    #451873

    Using the code below to open a form based on the SiteID. It works well but is there a way to modify this using a wildcard to show all like IDs? Example below. Thanks..

    SiteID = 1234A

    Show sites = 1234b and 1234c and 1234d

    DoCmd.OpenForm “Site_Frm”, , , “SiteID=” & Chr(34) & Me.SiteID & Chr(34)

    Viewing 0 reply threads
    Author
    Replies
    • #1113625

      You can use

      DoCmd.OpenForm "Site_Frm", , , "SiteID Like " & Chr(34) & Me.SiteID & "*" & Chr(34)

      • #1113634

        Hans it got me close butt.. I think I I didn’t exlpain it right..

        What I need is?

        My query shows the site as 1234A I need all sites like 1234* This showed only 1234A when I ran it. SO we need the last character removed and show all sites like 1234*.. Make sense>? Thanks..

        • #1113635

          OK, try

          DoCmd.OpenForm "Site_Frm", , , "SiteID Like " & Chr(34) & Left(Me.SiteID, Len(Me.SiteID) - 1) & "*" & Chr(34)

    Viewing 0 reply threads
    Reply To: Modify code (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: