Automatically fill-in control box

S

StaceyF

Hi, I'm new at Access and have been using this site for help. I have
something I can't figure out though...

I have a form where the user selects a Customer # from a combo box.
The next 2 controls (Bill To Name & Location) are then automatically
filled in with the correct information relating to the Customer #.

The way I accomplished this is, I set the Row Source of the Customer #
control to:
column0>Cust#
column1>Bill To Name
column2>Ship To Name
column3>Location
I then set the Bill To Name control source to '=[Customer
#].column(1)', Location control source to '=[Customer #].column(3)' (I
don't have a control on my form for Column 2 (Ship To) yet.)

The problem: Since my control source's for Bill To Name and Location
are set to look at another control, they are not populating the fields
in my Table! What am I doing wrong???:(

I tried setting up an AfterUpdate Event on the Bill To Name and
Location control's. I also tried putting in a new text box with the
control source set to the field in the table I want populated. Then I
did a SetValue macro. I'm chasing my tail....

Thanks for ANY help....Stacey
 
K

Klatuu

Those controls that have the reference to the combo box as the Control Source
are unbound controls. The controls need to be bound their respective
recordset fields. Existing records don't need to have the values entered,
but the new records do. You can load those controls from the After Update
event of your combo box:

With Me
If .NewRecord Then
.[Bill To Name] = Me.[Customer #].column(0)
.Location =[Customer #].column(2)
End If
End With

Note that combo box column numbers start with 0, so the first column is 0,
the second column is 1, etc.
 

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