Form Coding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have fields on a form from a table. For explanation purposes, I will show
you how it is set up:

ComboBox Named: AccountName

CustomerName
StreetAddress
City
State
ZipCode

In the OnClick section of the combobox, I have the following code:

Me!CustomerName = Me!AccountName.Column(2)
Me!StreetAddress = Me!AccountName.Column(3)
Me!City = Me!AccountName.Column(4)
Me!State = Me!AccountName.Column(5)
Me!ZipCode = Me!AccountName.Column(6)

I have a query selecting all of the fields in the exact order. I am sure
you can tell what I want it to do. It does the address, city, state, and
zip. It does not insert the name on the form. I checked the way the name is
spelled. The bound column in the combo box is 1. Basically the
StreetAddress is inserted into the name, the City in the StreetAddress field
and so on...The combo box is created from a table/query with Account Code,
Account Name, Address, City, State, Zip. Why doesn't the name work? You
guys/girls are always awesome! Thanks in advance for your help.

Sincerely,

Rain Man
 
Raymond said:
I have fields on a form from a table. For explanation purposes, I will show
you how it is set up:

ComboBox Named: AccountName

CustomerName
StreetAddress
City
State
ZipCode

In the OnClick section of the combobox, I have the following code:

Me!CustomerName = Me!AccountName.Column(2)
Me!StreetAddress = Me!AccountName.Column(3)
Me!City = Me!AccountName.Column(4)
Me!State = Me!AccountName.Column(5)
Me!ZipCode = Me!AccountName.Column(6)

I have a query selecting all of the fields in the exact order. I am sure
you can tell what I want it to do. It does the address, city, state, and
zip. It does not insert the name on the form. I checked the way the name is
spelled. The bound column in the combo box is 1. Basically the
StreetAddress is inserted into the name, the City in the StreetAddress field
and so on...The combo box is created from a table/query with Account Code,
Account Name, Address, City, State, Zip. Why doesn't the name work? You
guys/girls are always awesome! Thanks in advance for your help.


The Column property is zero based.

Me!CustomerName = Me!AccountName.Column(1)
Me!StreetAddress = Me!AccountName.Column(2)
. . .
 
you can get this problem if you try to use the field name itself in the
formula when the field and control name are the same. Rename the combo box to
something OTHER than the field name and you should be OK
 
Thank you sir

Marshall Barton said:
The Column property is zero based.

Me!CustomerName = Me!AccountName.Column(1)
Me!StreetAddress = Me!AccountName.Column(2)
. . .
 
Thank you also sir.

eddybarzoom said:
you can get this problem if you try to use the field name itself in the
formula when the field and control name are the same. Rename the combo box to
something OTHER than the field name and you should be OK
 
Back
Top