Results 1 to 6 of 6
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    Dlast with multiple criteria

    HI Guys



    im really strugling with the following code,


    Me.SOITEXTBOX = Nz(DLast("SOITextBox", "SOIDetails", "Partnumber='" & Forms!SOISWUAddDetails!PARTNUMBERTXTBOX & "'" & "And Uni = True" & "And Location='" & Forms!SOISWUDashBoard!EmployeeDepartmentTXTBox & "'"), 0)

    when this is run on i get

    Error 3075(Syntax error(Missing operator) in query Expression

    any help would be great as im getting lost now

    many thanks

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    What is the data type of Partnumber
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Many developers do not use DFirst or DLast. Can you use DMin or DMax on some field?
    You could add some spaces before Ands since your expression runs together.
    "'" & "And Uni = True" & "And Location='"
    Is SOITextBox really the name of a field in your table?

  4. #4
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    HI Bob

    Part Number and Location are both text data types
    uni is a yes no box

    Kind Regards

    Steve

  5. #5
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Orange

    Yes SOITextBox is a name of a feild in the table SOIDetails

    Knid regards
    Steve

  6. #6
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi All

    well after pulling out most of my hair i have removed the & "And Uni = True" part of the code and the code runs as i require, i will remove this part of the code as "Uni" appears to be always true when the form opens and there is no code that sets this to false

    i love access but its really hard taking over someone elses system when their is no documentaion

    don't you justlove 5 minute jobs

    anyway many thanks to both for all your help

    Steve

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

Similar Threads

  1. DLast not getting last record
    By Ron99 in forum Access
    Replies: 13
    Last Post: 06-21-2017, 05:25 AM
  2. DLast not working
    By abusaif in forum Access
    Replies: 4
    Last Post: 11-18-2014, 06:22 AM
  3. DLast
    By alyon in forum Access
    Replies: 4
    Last Post: 12-21-2012, 02:01 PM
  4. Replies: 2
    Last Post: 11-08-2012, 05:22 AM
  5. vba Dlast for each page!
    By Ivanho in forum Reports
    Replies: 0
    Last Post: 11-23-2011, 04:27 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