Results 1 to 4 of 4

Thread: WHERE x LIKE [% " & me.text & " %] vba and sql syntax issue

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    90

    WHERE x LIKE [% " & me.text & " %] vba and sql syntax issue

    Hello there,

    i'm working on a simple search application using sql commands on access 03.

    how can i add % % into this line of condition?

    WHERE Name LIKE [" & me.text & "].

    i'm thinking along the line of LIKE [ % " & me.text & " % ] which gives error.

    Any sugguestions?

    Thank You

    Astro

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WHERE x LIKE [% " & me.text & " %] vba and sql syntax issue

    What error was raised? Have you tried * instead?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: WHERE x LIKE [% " & me.text & " %] vba and sql syntax issue

    Whats the error?

    Try this assuming that Name is a field in your table and Me.Text is your forms caption that is the criteria for the clause. Also, Name is a Text field in your table.

    VB Code:
    1. SELECT * FROM Table1 WHERE [Name] LIKE '%" & Me.Text & "%'"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    90

    Re: WHERE x LIKE [% " & me.text & " %] vba and sql syntax issue

    hey there,

    sorry i changed it to LIKE '%" & Me.Text & "%'

    it works fine now =)

    Thanks!

    Astro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width