auto fill

H

Humbled Learner

Good Day,

I have a table, a query and a form all have

Auto Key
Client = Name
Party Number

When I open the form, if I type the client name, I would like the party
number to autofill... how and where would I accomplish this...

IE

Client AAA
Party # 111

Client BBB
Party # 222

When drop down box is opened and client AAA is selected, I would like the
next text box to auto populate with 222.

Thank You
 
A

Arvin Meyer [MVP]

Since they are both coming from the same recordsource, simply add the Party
Number field to the combo box. You can set it's width to zero (0") inches if
you like.

So lets assume that you now have 3 columns in your combo. Set the textbox to
read the 3rd column. The column index is zero based:

=ComboName.Column(2)
 
H

Humbled Learner

I'm sorry, I added the Party number to the Combo box as directed.

If I put =ClientID.Column(2) in the party number (text box) under default
value, nothing appears in the form. If I put =ClientID.Column(2) under the
party number control source, it works in the form but it does not save the
information to the table...

Where should I put the =ClientID.Column(2)?


Thanks Again
 
A

Arvin Meyer [MVP]

First, you should not be saving multiple copies of data to a table. The ONLY
multiple that should be saved is the Primary Key. That said, it is possible
to save it. Bind the textbox to the field in the underlying table and use
the AfterUpdate event of the combobox to stuff the data into the textbox:

Sub cboClientID_AfterUpdate()
Me.[txtParty Number] = ClientID.Column(2)
End Sub

Remember doing this violates Normalization. It also makes it possible to
change data in one table without changing it in the other, which results in
faulty data and lack of integrity therein.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access
 
H

Humbled Learner

Works liek a charm... TY
--
Thank You


Arvin Meyer said:
First, you should not be saving multiple copies of data to a table. The ONLY
multiple that should be saved is the Primary Key. That said, it is possible
to save it. Bind the textbox to the field in the underlying table and use
the AfterUpdate event of the combobox to stuff the data into the textbox:

Sub cboClientID_AfterUpdate()
Me.[txtParty Number] = ClientID.Column(2)
End Sub

Remember doing this violates Normalization. It also makes it possible to
change data in one table without changing it in the other, which results in
faulty data and lack of integrity therein.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


Humbled Learner said:
I'm sorry, I added the Party number to the Combo box as directed.

If I put =ClientID.Column(2) in the party number (text box) under default
value, nothing appears in the form. If I put =ClientID.Column(2) under
the
party number control source, it works in the form but it does not save the
information to the table...

Where should I put the =ClientID.Column(2)?


Thanks Again


.
 

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