Auto Fill code not working

Z

zonk2439

I am using the below code to auto fill two fields. However I can never get
column 2 to fill. I can switch the Phone and Email order and only column 1
will always populate but never colunm 2? Any idea why?

Private Sub Contact_AfterUpdate()
Me.Contact = Me.Contact.Column(0)
Me.Phone = Me.Contact.Column(1)
Me.Email = Me.Contact.Column(2)

Thanks in advance!!
 
L

Linq Adams via AccessMonster.com

What exactly are you trying to do with this line:

Me.Contact = Me.Contact.Column(0)

You appear to be trying to assign the combobox' value to itself, which may be
confusing Access. Try just using

Me.Phone = Me.Contact.Column(1)
Me.Email = Me.Contact.Column(2)
 
Z

zonk2439

Linq Adams via AccessMonster.com said:
What exactly are you trying to do with this line:

Me.Contact = Me.Contact.Column(0)

You appear to be trying to assign the combobox' value to itself, which may be
confusing Access. Try just using

Me.Phone = Me.Contact.Column(1)
Me.Email = Me.Contact.Column(2)

I tried removing the line Me.Contact = Me.Contact.Column(0) and get the same
results. When I run the query that this is based off of it does return all
three rows.
I just can't get that third field to populate.

Thanks.
 
D

Douglas J. Steele

Is the ColumnCount property set correctly? If it's only set to 1 or 2, you
won't be able to refer to Column(2)
 

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