Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup syntax not working

Status
Not open for further replies.

blizkij

Technical User
Oct 11, 2001
22
AU
Hi all,

I have a form where the user will enter a ClientRef (txt) and I have a text box I want to lookup that client ref and return the count of client ref from a query Count of Original Seats. I have tried the following but I just can't get it to look up!

= DLookup("[countofclient ref]", "count of original seats", "[client ref] = '" & [client ref] & "'")

Any advice on fixing this syntax would be greatly appreciated.

cheers
 
Is there supposed to be a space in the final [client ref]? You refer to earlier as ClientRef.

Syntax looks perfect. Try haard coding a known value thus:

DLookup("[countofclient ref]", "count of original seats", "[client ref] = 'ValidRef123'")

Finally consider copying and pasting the field names from the qry as an extra space can be almost invisble to our eyes

 
try putting bracket around the 'count of original seats' as below.

= DLookup("[countofclient ref]", "[count of original seats]", "[client ref] = '" & [client ref] & "'")

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
What is the SQL code of [count of original seats] and the name of the ClientRef control ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks for your replies.

ProgramError, I tried putting a bracket - still no change, also did a build event using the field names - still no result.

PHV - the sql is as follows:

SELECT [Client Data].[Client Ref], Count([Original Seat Data].[Client Ref]) AS [CountOfClient Ref]
FROM [Client Data] INNER JOIN [Original Seat Data] ON [Client Data].[Client Ref] = [Original Seat Data].[Client Ref]
GROUP BY [Client Data].[Client Ref];


I also tried using a table made from the Count of Original Seats to no avail.

So in the end I did a subform to the table and that works like a charm.

thanks all for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top