Results 1 to 5 of 5
  1. #1
    abdullahsikandar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    12

    Access Statement Error

    Hi,



    I am trying to match two columns in this statement:

    Set Rs1 = CurrentDb.OpenRecordset("select * from [Tracker] where [Fname] and [Lname] = '" & Rs.Fields("first name") & "'" & Rs.Fields("last name") & dbOpenDynaset)

    But it always gives me an error i don`t know where i am lacking right now. Can you all please help me out and let me know what i did wrong in it?

    or if it can be written in any other way....

    I want my Fname= first name
    Lname=Last Name

    Please help me.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try:

    Set Rs1 = CurrentDb.OpenRecordset("select * from [Tracker] where [Fname] & [Lname] = '" & Rs.Fields("first name") & Rs.Fields("last name") & "';", dbOpenDynaset)
    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.

  3. #3
    abdullahsikandar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    12
    Hi,

    Its working but not completely what i wanted the data which i am matching is already in the database i mean Fname and Lname but when i ran this query it said:

    Run-Time Error '3625'

    Item cannot be found in the collection corresponding to the requested name or ordinal

    Thanks for your reply... please help me.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I don't know your data, can only use what you provide.

    What table is Rs set to? Where are the fields "first name" and "last name"?
    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.

  5. #5
    abdullahsikandar is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    12
    Well, actually i got it your query works : Thanks a lot June7 .... u r the best

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

Similar Threads

  1. Error 3144: Syntax error in UPDATE statement??
    By Paintballlovr in forum Programming
    Replies: 7
    Last Post: 03-26-2014, 12:53 PM
  2. Error FROM clause of your SQL statement
    By Stephanie53 in forum Forms
    Replies: 8
    Last Post: 05-15-2013, 04:04 PM
  3. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  4. Expected End of Statement error
    By SamNotSoWise in forum Programming
    Replies: 5
    Last Post: 06-25-2012, 04:41 PM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 PM

Tags for this Thread

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