A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to do Lookup



 
 
Thread Tools Display Modes
  #1  
Old December 13th, 2006, 10:04 PM posted to microsoft.public.access.forms
TizTIz
external usenet poster
 
Posts: 3
Default How to do Lookup

I have a form that has a field called Currency Type and a field called
Exchange Rate. I have a table has a column for both of these with date in
each column. I want to enable the Currency Type field auto populate the
Exchange Rate field when the user selects a currency type (i.e. user selects
EUR as the Currency Type; Exchange Rate field will automatically be fill in
with the exchange rate that is listed in the table).

Have tried everything could think of to get this to work, but with no luck.
How do I get this to work?
  #2  
Old December 14th, 2006, 02:50 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default How to do Lookup

Hi TizTIz,

Use a dlookup similar to this:

=dlookup("EXCHANGE_RATE", "EXCHANGE_RATE_TABLE", "[CURRENCY_TYPE] = '" &
me.CURRENCY_TYPE_FIELD & "'")

Replace the bits in caps with the appropriate field/table names.

Hope that helps.

Damian.

"TizTIz" wrote:

I have a form that has a field called Currency Type and a field called
Exchange Rate. I have a table has a column for both of these with date in
each column. I want to enable the Currency Type field auto populate the
Exchange Rate field when the user selects a currency type (i.e. user selects
EUR as the Currency Type; Exchange Rate field will automatically be fill in
with the exchange rate that is listed in the table).

Have tried everything could think of to get this to work, but with no luck.
How do I get this to work?

  #3  
Old December 14th, 2006, 03:48 AM posted to microsoft.public.access.forms
tina
external usenet poster
 
Posts: 1,997
Default How to do Lookup

Damien's code can be used in the ControlSource property of a textbox control
in your form, to *display* the appropriate exchange rate - but it will not
populate a field in the form's underlying table.

if you want to capture the current exchange rate and save it in the record,
you can use the DLookup() function to retrieve it, in a macro or VBA code,
and then set the value of a field in the record to the retrieved rate.

hth


"TizTIz" wrote in message
...
I have a form that has a field called Currency Type and a field called
Exchange Rate. I have a table has a column for both of these with date in
each column. I want to enable the Currency Type field auto populate the
Exchange Rate field when the user selects a currency type (i.e. user

selects
EUR as the Currency Type; Exchange Rate field will automatically be fill

in
with the exchange rate that is listed in the table).

Have tried everything could think of to get this to work, but with no

luck.
How do I get this to work?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.