Help with Access, please!

A

Alex

Hello,

I need some help with Access. Anyone who can help, please
don't hesistate to post a response for me. Here's the
problem:

I have a form that I am creating. The form will contain
numerous fields for data entry. There are two fields that
I am stuck on. Let me explain, one of the fields is a
drop down menu with codes taken from a table i created.
Now, the other field is a 'code description field' I am
trying to have the descriptions of the codes appear in the
code description field when i choose a code from the drop
down menu from the previous field. am i making sense?
basically, if you choose a code from the drop-down menu in
the "code" field, i want the description of that code
(which was chosen) to appear in the other field
called, "code description."

if anyone can help me out, it will be greatly
appreciated.
thanks
alex
 
E

Eric

Try using the "On Change" event for the first dropdown.
Put in code that queries the value then looks up the
description and inserts it into the second field.

Eric
 
A

Alex

Eric,
hello, first, thanks so much for responing to my message.
can u elaborate a little bit on what u suggested? um, i
went to the properties on the first field (the drop down
menu) and it gave me a window asking to choose a 'builder'
either an expression builder, macro builder, or code
builder. i'm not sure which one to use to make the
description of the code appear in the second field.
let me give u sort of an example...

ok, lets say i am in the first field, and i click on the
the little arrow to show the menu.. and i choose the
code, "AL" now when i choose "AL" i want the description
to appear in the second field, that's just a text field..
so when i choose "AL"... "Apology Letter" will appear in
the second field.

thanks so much, let me know anything
alex
 
E

Eric

Alex,

OK, a little elaboration.

Click on the first field (in Design mode) and bring up the
properties box. Go to the "Events" tab. One of the
events is "On Change". Click that and you will get an
option to select "Event Procedure". Then click on the ...
to the right of it. That will bring up the Visual basic
editor and create an empty sub for you to fill in with
your code.

Say your first drop down is called "lstCode". Then, in
your sub you put something like:

varCode = lstCode.value
Then using that value (in your example = "AL"), you look
up its associated description. You can do this with
DLookup if necessary. (see access help for help with
DLookup)

Once you have the description, you set the description
text box value to that, say your text box is called txtDesc

Then you would write something like:

txtDesc.value = varDesc

Check it for errors and try it.

Thats it.
 

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