I am not sure what I am doing wrong. I am trying to get data from a few different queries and post the results to one report. I can't get past the first statement: "Dim rst As ADODB.Recordset".
I get compile error: "User-defined type not defined"
I appreciate any advice.
I get compile error: "User-defined type not defined"
I appreciate any advice.
Code:
Private Sub Report_Load()
Dim rst As ADODB.Recordset
Dim strCriteria As String
Dim StartDate1, EndDate1 As Date
Dim passengintot As Integer 'Passenger in total
Me![Date1] = Forms![Datechoice_frm]![StartDate_selected] set critaria
passengerintot = 0
Set rst = New ADODB.Recordset
strCriteria = "[Date-in] => #" & StartDate1 & #' And [Date-in] =< #" & EndDate1 & "#"
With rst
Set .ActiveConnection = CurrentProject.Connection
.Source = "Main_tbl"
.CursorLocation = adUseClient
.LockType = adLockBatchOptimistic
.CursorType = adOpenKeyset
.Open
.Find strCriteria
Do While Not .EOF
passengintot = passengintot + .Fields("Passenger-in")
Loop
'.UpdateBatch (no need to update)
End With
rst.Close
Set rst = Nothing
Me.Date1pass_in = passengerintot
End Sub