Results 1 to 3 of 3
  1. #1
    SunTop is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Aug 2016
    Posts
    93

    double/single quotes

    Hello Everyone




    I found this code in a sample database and I need to re-use it in my database, but access keeps throwing errors at me. I did some digging and I think the cause of the error is that TempVars("EmployeeType") is a string in my database, but it is a number in the sample database where I got this code from. I think I need to alter the double/singe quotes. I just can’t seem to figure it out, a little help please.


    UserAccess = Nz(DLookup("HasAccess", "tbl9EmployeeAccess", "EmployeeType_ID=" & TempVars("EmployeeType") & " AND FormName=' " & FormName & " ' "), False)

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    loose the TempVars("EmployeeType"), and put in a variable or a control from a form

    Nz(DLookup("HasAccess", "tbl9EmployeeAccess", "EmployeeType_ID=" & vEmpType & " AND FormName='" & FormName & "'"))
    or
    Nz(DLookup("HasAccess", "tbl9EmployeeAccess", "EmployeeType_ID=" & me.txtBoxEmpType & " AND FormName='" & FormName & "'"))

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What is the error message that you are getting? We can only guess at the answer if we don't know what the problem is!

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

Similar Threads

  1. need help with single and double quotes
    By vicsaccess in forum Programming
    Replies: 7
    Last Post: 12-27-2015, 06:40 PM
  2. Replies: 2
    Last Post: 05-29-2014, 09:30 PM
  3. Single and double quotes in a INSERT statement
    By dccjr in forum Programming
    Replies: 16
    Last Post: 03-14-2013, 09:50 PM
  4. Putting double quotes around text
    By weg220 in forum Queries
    Replies: 5
    Last Post: 12-21-2012, 10:16 AM
  5. Replace double quotes
    By Kay in forum Programming
    Replies: 27
    Last Post: 12-10-2012, 10:04 PM

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