Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2014
    Posts
    3

    What am I doing wrong?

    I keep getting error 3075 on this small code. What am I missing?




    Dim strsearch As String
    Dim strtext As String
    strtext = Me.Text22.Value
    strsearch = "SELECT * from tbl_Inventtab where ((Item# like ""*" & strtext & "*""))"
    Me.RecordSource = strsearch

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    A few points:

    When you post code, post all of the code. What you are showing is a part of something-- some Form event is my guess.
    What do you think this is/should do?
    Don't use special characters in field or object names --use only alphabetics and underscore "_". The # sign is an issue.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Maybe the # character in the field name is the issue. Should avoid spaces and special characters/punctuation (underscore is exception) in naming convention. If used, have to enclose name in [].

    I prefer to apply filter instead of changing the RecordSource.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    As stated, special characters when part of Field/Object names are problematical, and should be avoided. The Octothorp/Pound Sound/Hash Mark (#) can be particularly troublesome because in VBA it is used as the Delimiter for literal Dates; as such, the Access gnomes expect to see them in pairs, not in one-ofs, and using it like this is probably causing the compiler to choke.

    Try changing the name from Item# to ItemNo and see what happens.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. what is wrong
    By Dinoshop in forum Access
    Replies: 1
    Last Post: 07-11-2014, 06:22 AM
  2. VBA gone wrong with an if
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 10-21-2013, 05:38 PM
  3. What's wrong!
    By khalid in forum Programming
    Replies: 15
    Last Post: 06-27-2011, 06:38 AM
  4. What is wrong with this IFF?
    By bburton in forum Reports
    Replies: 2
    Last Post: 03-16-2011, 10:42 AM
  5. What am I doing wrong?
    By brandon in forum Access
    Replies: 2
    Last Post: 08-03-2008, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums