Results 1 to 4 of 4
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185

    Runtime Error 3075

    Hi Guy's, I probably cant see the wood for the trees here, this looks ok to me but must be missing something, any idea ? note there is definite records within the date criteria

    Click image for larger version. 

Name:	Capture.JPG 
Views:	16 
Size:	17.5 KB 
ID:	40382

    Code:
    Dim rs as DAO.Recordset, Dim StartDate As Date, EndDate as Date
    StartDate = Forms!frmOutputs!txtStartDate
    EndDate = Forms!frmOutputs!txtEndDate
    Set rs = CurrentDb.OpenRecordset("Select tblInvoices.InvoiceDate, tblInvoices.InvoiceNumber, tblInvoices.Customer, " _
                                    & "tblInvoices.Qty, tblInvoices.Ref, tblInvoices.Description, tblInvoices.Total, " _
                                    & "tblInvoices.Paid, tblInvoices.PaidDate, " _
                                    & "WHERE InvoiceDate Between #" & StartDate & "# And #" & EndDate & "#")


  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    The comma before the Where is incorrect
    tblInvoices.PaidDate,
    and you need a From..
    perhaps you missed a line??

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185
    Hi guy's, what is wrong with this recordset please ?, fields are correct, tried running a query to test records are there and they are

    Click image for larger version. 

Name:	Capture.JPG 
Views:	10 
Size:	18.2 KB 
ID:	40394

    Code:
    Dim StartDate As Date, EndDate As Date
    StartDate = Me.txtStartDate
    EndDate = Me.txtEndDate
    Set rs = CurrentDb.OpenRecordset("Select tblInvoices.InvoiceDate, tblInvoices.InvoiceNumber, tblInvoices.Customer, " _ 
    & "tblInvoices.Qty, tblInvoices.Ref, tblInvoices.Description, tblInvoices.Total, tblInvoices.Paid, tblInvoices.PaidDate, " _
                                    & "FROM tblInvoices, " _
                                    & "WHERE InvoiceDate Between #" & StartDate & "# And #" & EndDate & "#")

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Do you have option explicit declared?
    One easy way to avoid errors like this is to assign your Sql string to a variable and debug print it to inspect it for accuracy.

    Code:
    Dim strSql as string
    
    strSql = "Select tblInvoices.InvoiceDate, tblInvoices.InvoiceNumber, tblInvoices.Customer, " _ 
    & "tblInvoices.Qty, tblInvoices.Ref, tblInvoices.Description, tblInvoices.Total, tblInvoices.Paid, tblInvoices.PaidDate, " _
    & "FROM tblInvoices, " _
    & "WHERE InvoiceDate Between #" & StartDate & "# And #" & EndDate & "#")
    
    Debug.Print strSql
    
    Set rs = CurrentDb.OpenRecordset(strSql)
    what are your date settings? could it be 30\11\2019?

    here's a good write up on dates ... https://codekabinett.com/rdumps.php?...ype-vba-access

    note the line:
    The Jet-/Ace-Database-Engine, however, is stricter about dates. It will only recognize date-strings in either the US-Date-Format (MM/DD/YYYY) or the international ISO-Format (YYYY-MM-DD).

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

Similar Threads

  1. recordset Runtime Error 3075
    By DMT Dave in forum Access
    Replies: 2
    Last Post: 02-20-2019, 06:11 AM
  2. Runtime error 3075
    By Thompyt in forum Programming
    Replies: 2
    Last Post: 11-21-2017, 04:43 PM
  3. runtime error 3075
    By Compufreak in forum Access
    Replies: 3
    Last Post: 08-14-2012, 01:40 AM
  4. RunTime error 3075
    By Compufreak in forum Access
    Replies: 3
    Last Post: 07-25-2012, 02:18 AM
  5. Runtime 3075 error
    By whm1 in forum Programming
    Replies: 4
    Last Post: 03-24-2010, 02:50 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