DLookup

NT100

Registered User.
Local time
Today, 19:20
Joined
Jul 29, 2017
Messages
148
Hi,

I'm working on DLookup with 3 criteria in the following scripts

Dim iRoatation, iSession as integer;

iRoataton = 1
iSession = 1


DLookup("[Session]","tblTAssign_FPA","[AcademicYr] = " & txtApptYr.Value & " AND " & [Rotation] = iRotation & " AND " & [Session] = iSession & ")"

However, it is syntax error. Would you have any suggestions?

NT100
 
AND [Rotation] =" & iRotation & " AND [Session] =" & iSession & ")"
 
Close! ;)

I think you want:

DLookup("[Session]","tblTAssign_FPA","[AcademicYr] = " & txtApptYr.Value & " AND [Rotation] = " & iRotation & " AND [Session] = " & iSession )
 
:cool:Getting closer .... :o

If the academic year is a string value e.g. 2016-17, you need text delimiters for that part - added in RED below

Code:
DLookup("[Session]","tblTAssign_FPA","[AcademicYr] =[COLOR="Red"] '[/COLOR]" & txtApptYr.Value & "[COLOR="red"]'[/COLOR] AND [Rotation] = " & iRotation & " AND [Session] = " & iSession )

BUT this is looking up the value of the Session field when one of the criteria is that Session is iSession which equals 1

So getting closer still ....:rolleyes:

Code:
[Session]=1
 
Last edited:

Users who are viewing this thread

Back
Top Bottom