Using List Boxes and Multiple Feilds.

  • Thread starter Thread starter Bombay
  • Start date Start date
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?
 
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
 
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)
 
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
 
You are referencing [StateOrProvince] . On your original post the textbox
name was [State]. That could be the problem.
 
Back
Top