2nd field autofill

K

kjames

I hope my question is easy. I just can't come up with a solution.

I have two fields: Cost Center and Cost Center Description in a
table. In my form I put in a drop down field that pulls the cost
center and puts the answer in the field. I want the cost center
description field to automatically fill in the correct description
from what was put in the cost center field.

Can you please help?

I would appreciate any advice.

Thanks you
 
G

Guest

Let Cost_Center have a 2 column drop down list (CC and CC-description). In
Cost_Center's after update event put:
Me.Cost_Center = Me.Cost_Center_Description.Column(1)
which will automatically fill in Cost_Center_Description.
 
L

Larissa25

I have the same question and I tried to follow the directions given, but when
I put the line in the "After Update" section in the form I get an error
"Cannot find the macro "Me."

I'm comfortable using Access, but I'm limited. I haven't used code or macros
before. I did make my column a 2-column drop down list (in my case it's the
billing code and the billing code description) and I'm creating a form. Can
you give me a boost?
-Larissa
 
J

John W. Vinson

I have the same question and I tried to follow the directions given, but when
I put the line in the "After Update" section in the form I get an error
"Cannot find the macro "Me."
I'm comfortable using Access, but I'm limited. I haven't used code or macros
before. I did make my column a 2-column drop down list (in my case it's the
billing code and the billing code description) and I'm creating a form. Can
you give me a boost?
-Larissa

Instead of putting the code directly in the box next to the AfterUpdate event,
click the ... icon by it and choose Code Builder. The event should show
[Event Procedure].

John W. Vinson [MVP]
 
L

Larissa25

John,
I really appreciate the fast reply!
I don't think I know enough about the code builder yet to use it
efficiently, and I don't want you to have to bring me up to speed. I think
all I need is a quick reference guide that will tell me how the language is
used (e.g. "me" means . . ., periods indicate ____, that kind of thing). I've
used SQL before and think I might be getting confused. Can you recommend a
good place to look for more information on the code builder?

More information about my database: I created a 2-column table that contains
the billing code and the description (title: ICD9). I created another table
that has the patient ID and the billing code, because a patient can have any
number of billing codes ascribed to them (title: Diagnosis), and I created a
2-column lookup box for the billing code field that pulls from the ICD9
table. Now I'm trying to create the form for the Diagnosis table and have the
description automatically pulled in after I put in the billing code.

I appreciate your help!

John W. Vinson said:
I have the same question and I tried to follow the directions given, but when
I put the line in the "After Update" section in the form I get an error
"Cannot find the macro "Me."
I'm comfortable using Access, but I'm limited. I haven't used code or macros
before. I did make my column a 2-column drop down list (in my case it's the
billing code and the billing code description) and I'm creating a form. Can
you give me a boost?
-Larissa

Instead of putting the code directly in the box next to the AfterUpdate event,
click the ... icon by it and choose Code Builder. The event should show
[Event Procedure].

John W. Vinson [MVP]
 
J

John W. Vinson

John,
I really appreciate the fast reply!
I don't think I know enough about the code builder yet to use it
efficiently, and I don't want you to have to bring me up to speed. I think
all I need is a quick reference guide that will tell me how the language is
used (e.g. "me" means . . ., periods indicate ____, that kind of thing). I've
used SQL before and think I might be getting confused. Can you recommend a
good place to look for more information on the code builder?

The first resource is right on your own computer: open the VBA editor and hit
the F1 key for help. There are also lots of resources at:

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

VBA has a substantial learning curve and will require some study; getting one
of the VBA books in these references, and studying it, will have benefits.

For some quick answers - Me! means "this current form", shortcut for the
specific (and therefore limited) Forms!NameOfMyForm!; periods are delimiters
used to set one thing off from another thing.
More information about my database: I created a 2-column table that contains
the billing code and the description (title: ICD9). I created another table
that has the patient ID and the billing code, because a patient can have any
number of billing codes ascribed to them (title: Diagnosis), and I created a
2-column lookup box for the billing code field that pulls from the ICD9
table. Now I'm trying to create the form for the Diagnosis table and have the
description automatically pulled in after I put in the billing code.

Where are you trying to put the description? Do you just want to *display* it
on the form (good) or *store* it redundantly in another table (not at all
good)? TO display it, you don't need any code at all; instead, put a textbox
on the form with a control source

=comboboxname.Column(n)

where comboboxname is the name of the ICD9 combo box, and (n) is the zero
based index of the field you want to see - (1) to display the second column.

John W. Vinson [MVP]
 
L

Larissa25

Aw, geez! Your "is this what you're trying to do?" suggestion was what I was
looking for! Typical of me to make it more complicated than it needs to be. I
am going to look up the other sources you gave, and I know your response will
also guide a number of other people in the right direction.

Thanks for your time and thoughtful answer! It's working great!
-Larissa
 

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