Adding a queried field into a form

T

Tellis2112

I have a form that I use to enter client information. I have a query
elsewhere that gives me a balance for the client. I am looking to add a
field into the entry form that displays the results of the query for that
client.
I tried using dlookup, but keep getting an error on it.
 
D

Dennis

You should have posted the DlookUp so we could correct it.
The syntax for Dlookup is as below

=DLookUp("[FieldName]","Client Table","[FieldInTable] = " & [ClientID])
 
T

Tellis2112

Well, you were right that the format was incorrect. I ommited the " &. I'm
still not able to get it to work, though. Here is the dlookup statement:

=DLookUp("[CurrentStatus]","BET_Status_01-LastAction3","[Prosp] = " &
[ProspectID] )

It's actually not the balance, but the last status that I'm trying to
display. I just figured that balance was easier to explain than status when
I created the post.

Thank again.


Dennis said:
You should have posted the DlookUp so we could correct it.
The syntax for Dlookup is as below

=DLookUp("[FieldName]","Client Table","[FieldInTable] = " & [ClientID])

Tellis2112 said:
I have a form that I use to enter client information. I have a query
elsewhere that gives me a balance for the client. I am looking to add a
field into the entry form that displays the results of the query for that
client.
I tried using dlookup, but keep getting an error on it.
 
L

Linq Adams via AccessMonster.com

The exact syntax for the WHERE portion of the DLookUp varies according to the
datatype of the field involved. Your statement is correct if [Prosp} is
numeric, but ID numbers frequently are actually text (as they should be) and
this may be your problem.

'Numeric
DLookup("[CurrentStatus]", "BET_Status_01-LastAction3", "[Prosp] = " & Me.
ProspectID)

'Text
DLookup("[CurrentStatus]", "BET_Status_01-LastAction3", "[Prosp] = '" & Me.
ProspectID & "'")

Date
DLookup("[CurrentStatus]", "BET_Status_01-LastAction3", "[Prosp] = #" & Me.
ProspectID & "#")
 
Top