Using List Boxes and Multiple Feilds.

B

Bombay

I have a Form that is used for an invoice.

There is a Field labeled Customer ID that is a List Box.

I have these other fields on the Form that I wish to autofill with the
Customer's Info based on what Customer is selected in the Listbox Customer ID.

State
City
Zip
Address

All of those are fields I want to auto fill with that customers info, how
would I do this?
 
M

Mark A. Sam

Bombay,

The RowSource property of the listbox needs to include all of the fields. I
am assumning [Customer ID] would be in the first positon, which when
referencing will be Column(0).

Set the ColumnCount property of the listbox to 5.

On the AfterUpdate event of the listbox put this code:

[State] = [Customer ID].Column(1) '[Customer ID] is Column(0)
[City] = [Customer ID].Column(2)
[StateZip] = [Customer ID].Column(3)
[Address] = [Customer ID].Column(4)


And this assumes that the fields or in the order listed below and the field
names match the Texbox names..

God Bless,

Mark A. Sam
 
B

Bombay

Mark I get this problem

"The Expression you entered contains invalid syntax"

Code used

[StateOrProvince] = [Customer ID].Column(1)
[City] = [Customer ID].Column(2)
[PostalCode] = [Customer ID].Column(3)
[BillAdd1] = [Customer ID].Column(4)
 
B

Bombay

Is a list box sufficient enough to do this?

Is there something I need to do in the other fields(City etc) to make sure
it updates?

Brian
 
M

Mark A. Sam

You are referencing [StateOrProvince] . On your original post the textbox
name was [State]. That could be the problem.
 

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

Similar Threads


Top