Runtime Error 3061 (1 Viewer)

sroot

Registered User.
Local time
Today, 07:37
Joined
Mar 18, 2013
Messages
53
Im thinking i have been looking at the computer too long today... I keep getting runtime error 3061 when i open this report. I didnt build this but i was told it use to work. Any thoughts? Thanks in advance!

Code:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    
    Dim vcountmisdoors As String
    Dim vqdf As QueryDef
    Dim vrescset As String
    
    [txtbox_tot67] = 0
    [txtbox_tot91] = 0
    
 
    
    
    
    Set db = CurrentDb
    Set vqdf = db.CreateQueryDef("", "SELECT [1-1tblOXDMaster].* " _
                                & "FROM [1-1tblOXDMaster] " _
                                & "WHERE ([1-1tblOXDMaster].status IN (67, 91)) " _
                                & "AND (([1-1tblOXDMaster].Upd_dm >= #" & [txtbox_startshift] & "#) " _
                                & "AND ([1-1tblOXDMaster].Upd_dm <= #" & [txtbox_EndShift] & "#));")
    
    With vqdf
    [COLOR=Red]Set vrecset = vqdf.OpenRecordset[/COLOR]
        With vrecset
        If (Not .BOF Or Not .EOF) Then
            .MoveFirst
            Do
                If vrecset("status") = 67 Then
                    [txtbox_tot67] = [txtbox_tot67] + 1
                End If
                If vrecset("status") = 91 Then
                    [txtbox_tot91] = [txtbox_tot91] + 1
                End If
                .MoveNext
            Loop Until .EOF
        End If
        End With
    End With
    vrecset.Close
    vqdf.Close
    db.Close
    
    Set db = CurrentDb
    Set vrecset = db.OpenRecordset("SELECT [1-1tblOXDMaster].[fp_vehicle_cls], " _
    & "[2-1tblReceivingDoors].*, [1-1tblOXDMaster].[upd_dm] " _
    & "FROM [1-1tblOXDMaster] LEFT JOIN [2-1tblReceivingDoors] ON " _
    & "([1-1tblOXDMaster].[rr] = [2-1tblReceivingDoors].rr) " _
    & "AND ([1-1tblOXDMaster].[po] = [2-1tblReceivingDoors].po) " _
    & "WHERE [1-1tblOXDMaster].[upd_dm]>=#" & [txtbox_startshift] & "# " _
    & "AND [1-1tblOXDMaster].[upd_dm]<=#" & [txtbox_EndShift] & "# " _
    & "AND [2-1tblReceivingDoors].receivingdoor = null;")
    With vrecset
        If (Not .BOF Or Not .EOF) Then
            .MoveLast
            vcountmisdoors = .RecordCount
        Else
            vcountmisdoors = 0
        End If
    End With
    vrecset.Close
    db.Close
    [TxtBox_NoRecDoor] = vcountmisdoors
    
    
End Sub
 

bob fitz

AWF VIP
Local time
Today, 15:37
Joined
May 23, 2011
Messages
4,726
Could it be that there is no date in either txtbox_startshift or in txtbox_EndShift
 

sroot

Registered User.
Local time
Today, 07:37
Joined
Mar 18, 2013
Messages
53
They are both filled in
 

sroot

Registered User.
Local time
Today, 07:37
Joined
Mar 18, 2013
Messages
53
yeah i have a ton of queries that use them. They are an automatic date and time field
 

bob fitz

AWF VIP
Local time
Today, 15:37
Joined
May 23, 2011
Messages
4,726
Can you post a copy of the db to illustrate the problem
 

plog

Banishment Pending
Local time
Today, 09:37
Joined
May 11, 2011
Messages
11,669
You need to find out what your SQL actually is. Set it to a variable and then spit it out. Then run that SQL by itself in a query object.
 

Users who are viewing this thread

Top Bottom