d-lookup question

S

siggy

I use:
=DLookUp("COMMODITY","RATES","Rate_Check = [RATES.Rate_Code]")
in a form field the display textual data based on what is entered in a form
field.


the Problem is that this look-up data is NOT displayed right away
( as soon as the first field is entered ) ... it is only displayed after
the record
is saved...

I would like the field to be populated with the LOOK-UP data as soon
as the first field text is entered and the user TABS out of that field...


siggy
 
A

Allen Browne

The square brackets should be around the table name and field name
individually if you use them. You can probably drop the table name. And it
would help to concatenate the value into the expression.

Try:
=DLookUp("COMMODITY","RATES","Rate_Check = " & Rate_Code)
or add the extra quotes if Rate_Code is a Text type field:
=DLookUp("COMMODITY","RATES","Rate_Check = """ & Rate_Code & """")

Another alternative would be to create a query that uses both the table you
currentlly use for your form and the Rates table. Use the query as the
RecordSource for your form, and you can get the value of the Commodity field
in the source query instead of using DLookup().
 
S

siggy

second DLOOKUP option works like a charm

much - THANKS



Allen Browne said:
The square brackets should be around the table name and field name
individually if you use them. You can probably drop the table name. And it
would help to concatenate the value into the expression.

Try:
=DLookUp("COMMODITY","RATES","Rate_Check = " & Rate_Code)
or add the extra quotes if Rate_Code is a Text type field:
=DLookUp("COMMODITY","RATES","Rate_Check = """ & Rate_Code & """")

Another alternative would be to create a query that uses both the table
you currentlly use for your form and the Rates table. Use the query as the
RecordSource for your form, and you can get the value of the Commodity
field in the source query instead of using DLookup().

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

siggy said:
I use:
=DLookUp("COMMODITY","RATES","Rate_Check = [RATES.Rate_Code]")
in a form field the display textual data based on what is entered in a
form field.


the Problem is that this look-up data is NOT displayed right away
( as soon as the first field is entered ) ... it is only displayed after
the record
is saved...

I would like the field to be populated with the LOOK-UP data as soon
as the first field text is entered and the user TABS out of that field...
 
S

siggy

sorry.....

it appears that the DLookUP you suggested returns the
same result for all values of: 'Rate_Check' -- not
the result where Rate_Check = Rate_Code.................



Allen Browne said:
The square brackets should be around the table name and field name
individually if you use them. You can probably drop the table name. And it
would help to concatenate the value into the expression.

Try:
=DLookUp("COMMODITY","RATES","Rate_Check = " & Rate_Code)
or add the extra quotes if Rate_Code is a Text type field:
=DLookUp("COMMODITY","RATES","Rate_Check = """ & Rate_Code & """")

Another alternative would be to create a query that uses both the table
you currentlly use for your form and the Rates table. Use the query as the
RecordSource for your form, and you can get the value of the Commodity
field in the source query instead of using DLookup().

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

siggy said:
I use:
=DLookUp("COMMODITY","RATES","Rate_Check = [RATES.Rate_Code]")
in a form field the display textual data based on what is entered in a
form field.


the Problem is that this look-up data is NOT displayed right away
( as soon as the first field is entered ) ... it is only displayed after
the record
is saved...

I would like the field to be populated with the LOOK-UP data as soon
as the first field text is entered and the user TABS out of that field...
 
A

Allen Browne

Is there a control named Rate_Code in your form?

If so, it should concatenate the values into the 3rd argument, and return
the matching value.

For more help, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

siggy said:
sorry.....

it appears that the DLookUP you suggested returns the
same result for all values of: 'Rate_Check' -- not
the result where Rate_Check = Rate_Code.................



Allen Browne said:
The square brackets should be around the table name and field name
individually if you use them. You can probably drop the table name. And
it would help to concatenate the value into the expression.

Try:
=DLookUp("COMMODITY","RATES","Rate_Check = " & Rate_Code)
or add the extra quotes if Rate_Code is a Text type field:
=DLookUp("COMMODITY","RATES","Rate_Check = """ & Rate_Code & """")

Another alternative would be to create a query that uses both the table
you currentlly use for your form and the Rates table. Use the query as
the RecordSource for your form, and you can get the value of the
Commodity field in the source query instead of using DLookup().

siggy said:
I use:
=DLookUp("COMMODITY","RATES","Rate_Check = [RATES.Rate_Code]")
in a form field the display textual data based on what is entered in a
form field.


the Problem is that this look-up data is NOT displayed right away
( as soon as the first field is entered ) ... it is only displayed
after the record
is saved...

I would like the field to be populated with the LOOK-UP data as soon
as the first field text is entered and the user TABS out of that
field...
 

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