Syntax of DLookup

E

Eric

Can any one please tell me the syntax is correct

Me.List17=DLookUp(["Equipment1"],["tbl_EquipmentChronology"],["TicketNum]="[
& tbl_Events.TicketNum & ]" And [Outlet]="[ &
tbl_Events.PPVVOD_Outlet &])

Thanks,
 
D

Dirk Goldgar

Eric said:
Can any one please tell me the syntax is correct

Me.List17=DLookUp(["Equipment1"],["tbl_EquipmentChronology"],["TicketNum
]="[
& tbl_Events.TicketNum & ]" And [Outlet]="[ &
tbl_Events.PPVVOD_Outlet &])

I can't tell you the syntax is correct, because it isn't. <g> If you
use the square brackets, you need to put them inside the quotes, not
outside. However, it doesn't look like you need them at all in this
case.

Here's a first attempt at correction:

Me.List17 = _
DLookUp( _
"Equipment1", _
"tbl_EquipmentChronology", _
"TicketNum=" & tbl_Events.TicketNum & _
" And Outlet=" & tbl_Events.PPVVOD_Outlet)

I can't say whether your references to tbl_Events.TicketNum and
tbl_Events.PPVVOD_Outlet are correct or not, because I don't know where
this expression is being evaluated. It may well be that you should just
be writing:

Me.List17 = _
DLookUp( _
"Equipment1", _
"tbl_EquipmentChronology", _
"TicketNum=" & Me.TicketNum & _
" And Outlet=" & Me.PPVVOD_Outlet)

But things could be more complicated than that; I can't be sure.

Also, the above criteria expressions assume that TicketNum and Outlet
are numeric fields. If they are text fields, the values being embedded
in the criteria argument need to be enclosed in quotes; e.g,

" And Outlet='" & Me.PPVVOD_Outlet & "'")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top