chuckcoleman
Registered User.
- Local time
- Yesterday, 23:33
- Joined
- Aug 20, 2010
- Messages
- 363
I have a query that has a DLookUp function in it with criteria but it's not producing the results I need.
The DLookUp is-
TESTLookUp("LaborRate","[Locations]","[Location Code]='" & [RepairLocation] & "' AND '" & [VendorReferenceNo] & "' Like [InvPrefix] & '*'")
[RepairLocation] and [VendorReferenceNo] are in the underlying table to the query. [LaborRate] and InvPrefix are in the [Locations] table, where the DLookUp, looks.
Everything works in the criteria except the 'Like' statement. The [Location] table looks like:
LocationName----------LocationCode-------LocPrefix-------InvPrefix----LaborRte
Laredo...........................AX482................AX482.............................$36.00
Laredo-LEM----------------AX482------------AX482-LAR........LAR............$0.00
San Antonio...................SO232...............SO232...............................$40.00
Council Auto..................NX001................NX001-UPA........UPA...........$80.00
Council M&R..................NX001................NX001-CBM........CBM..........$30.33
The InvPrefix values for Laredo and San Antonio are blank; no entry.
When I have records that the query uses and those records include only Laredo-LEM, I see a LaborRte of $36.00 instead of $0.00
What am I doing wrong?
Thanks,
Chuck
The DLookUp is-
TESTLookUp("LaborRate","[Locations]","[Location Code]='" & [RepairLocation] & "' AND '" & [VendorReferenceNo] & "' Like [InvPrefix] & '*'")
[RepairLocation] and [VendorReferenceNo] are in the underlying table to the query. [LaborRate] and InvPrefix are in the [Locations] table, where the DLookUp, looks.
Everything works in the criteria except the 'Like' statement. The [Location] table looks like:
LocationName----------LocationCode-------LocPrefix-------InvPrefix----LaborRte
Laredo...........................AX482................AX482.............................$36.00
Laredo-LEM----------------AX482------------AX482-LAR........LAR............$0.00
San Antonio...................SO232...............SO232...............................$40.00
Council Auto..................NX001................NX001-UPA........UPA...........$80.00
Council M&R..................NX001................NX001-CBM........CBM..........$30.33
The InvPrefix values for Laredo and San Antonio are blank; no entry.
When I have records that the query uses and those records include only Laredo-LEM, I see a LaborRte of $36.00 instead of $0.00
What am I doing wrong?
Thanks,
Chuck
Last edited: