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