Here is my VBA Dlookup Code:
Print out:
Aircraft
31/12/2013
AM Peak
0
At the bottom im printing the content of the controls which are on my form.
These should return 1 number, but for some reason it does not. Ive used this code many times but I cant figure out why nothing is being returned.
Any help would be appreciated..
Code:
Public Sub test()
Dim frm As Form
Set frm = Forms!StationLevelSummary
i = Nz(DLookup(" [tblPaxAtStationLevel]![number_of_days]", "tblPaxAtStationLevel", _
"[tblPaxAtStationLevel]![Time_Band] = '" & frm.txtbox_am & "' " & _
" And [tblPaxAtStationLevel]![station] = '" & frm.[filter_station] & "' " & _
"AND [tblPaxAtStationLevel]![full_date] = " & frm.filter_spm_year & " "), 0)
Debug.Print frm.txtbox_am
Debug.Print frm.[filter_station]
Debug.Print frm.filter_spm_year
Debug.Print i
End Sub
Print out:
Aircraft
31/12/2013
AM Peak
0
At the bottom im printing the content of the controls which are on my form.
These should return 1 number, but for some reason it does not. Ive used this code many times but I cant figure out why nothing is being returned.
Any help would be appreciated..