By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

Using a combo box to prefil other fields

P: n/a
I have a form where the user selects a client name originally from a
table and then proceeds to complete other details in a sub form. The
users asked to see two pieces of information relating to the client on
this form, both of which are stored in the client table. As I had
never done this before I found out via this group how to create a
combo box called claimClientName that got its data from a query and it
is bound to column 1 of that query. This works fine.

I then created a new field and the source is

=claimClientName.Column(1)

This also works fine. I read here that the number of the column should
assume that the first column is 0 so the data that is in the field is
in fact column 2 if you just run the query.

So, on to the second piece of data. I copied the field and just
changed the source to

=claimClientName.Column(2)

Nothing doing...

I've re-created the field from scratch in case I copied something that
shouldn't be there but the same thing happens i.e. nothing. No error
message, no data, just a blank field.

I can't seem to find anything wrong but I cannot get the second field
to function. I have tried changing the column order in the query but
that just changes the data that appears in the field that works. I've
tried making the two fields identical and they then both display the
same column data i.e. column 1. If I change the fields to both look at
column 2 then neither work.

I've changed the code to =claimClientName.Column(0)and this puts the
data from the first query column (the client name) in the field.

There definitely is data in the problem column just in case anyone
wondered!!!

Is there some restriction on the number of columns this method works
for? I've tried every different permutation of columns but I can't get
it to work. I've changed it also to =claimClientName.Column(3) (not
sure why, clutching at straws) and this is blank as you would expect.

Would appreciate any ideas

Regards

Michelle
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Michelle,

You need to set the ColumnCount property of the combobox to the max number of
columns you want to use with the Column(x) property. =claimClientName.Column(1)
works because your ColumnCount property is set to 2. =claimClientName.Column(2)
does not work because ColumnCount property is set to 2 and you are specifying
the third column. Change the ColumnCount property to 3 and
=claimClientName.Column(2) will work.

Note: When you change the ColumnCount property to 3, be sure to also add the
ColumnWidth for column 3.

The ColumnCount and ColumnWidth properties are found under the Format tab of
properties for the combobox.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Michelle Collier-Moore" <mi******************@hotmail.com> wrote in message
news:68**************************@posting.google.c om...
I have a form where the user selects a client name originally from a
table and then proceeds to complete other details in a sub form. The
users asked to see two pieces of information relating to the client on
this form, both of which are stored in the client table. As I had
never done this before I found out via this group how to create a
combo box called claimClientName that got its data from a query and it
is bound to column 1 of that query. This works fine.

I then created a new field and the source is

=claimClientName.Column(1)

This also works fine. I read here that the number of the column should
assume that the first column is 0 so the data that is in the field is
in fact column 2 if you just run the query.

So, on to the second piece of data. I copied the field and just
changed the source to

=claimClientName.Column(2)

Nothing doing...

I've re-created the field from scratch in case I copied something that
shouldn't be there but the same thing happens i.e. nothing. No error
message, no data, just a blank field.

I can't seem to find anything wrong but I cannot get the second field
to function. I have tried changing the column order in the query but
that just changes the data that appears in the field that works. I've
tried making the two fields identical and they then both display the
same column data i.e. column 1. If I change the fields to both look at
column 2 then neither work.

I've changed the code to =claimClientName.Column(0)and this puts the
data from the first query column (the client name) in the field.

There definitely is data in the problem column just in case anyone
wondered!!!

Is there some restriction on the number of columns this method works
for? I've tried every different permutation of columns but I can't get
it to work. I've changed it also to =claimClientName.Column(3) (not
sure why, clutching at straws) and this is blank as you would expect.

Would appreciate any ideas

Regards

Michelle

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.