Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 03:02 PM
Michelle Collier-Moore
Guest
 
Posts: n/a
Default Using a combo box to prefil other fields

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
  #2  
Old November 12th, 2005, 03:02 PM
PC Datasheet
Guest
 
Posts: n/a
Default Re: Using a combo box to prefil other fields

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" <michellecolliermoore@hotmail.com> wrote in message
news:68f0568e.0310060504.39cdbe55@posting.google.c om...[color=blue]
> 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[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,174 network members.