Keeping a combo in synch

A

anthony

On my form I have a combo which looks up a record in the underlying
table. The columns are ChildAOLTermID (primary key), PhotoID (primary
key) and a column with an amalgamation of fields eg [LastName] & ", "
& [FirstName] etc. The first two columns are set at 0 size and the
lookup is actually carried out using the third. I want to put
something in the current event of the form so that the combo reflects
the current record as I move back and forth through the records. I
imagined that:

Me.cboFindRecord.Column(0) = ChildAOLTermID AND
Me.cboFindRecord.Column(1) = PhotoID

might work but I get "Object required". I've played around with
various different approaches but as soon as I deploy .column, I get
the error. Both column(0) and column(1) need to be populated correctly
as together they form the unique record

Many thanks for your help
 
J

Jeanette Cunningham

Anthony,
you set only the bound column of the combo to whatever the keyID of the form
is.
The combo auto gets the other columns that are in its row source.
Me.cboFindRecord = Me.txtkeyID

where txtkeyID is the name of the text box control for the keyID of your
form

Jeanette Cunningham
 
A

anthony

you set only the bound column of the combo to whatever the keyID of the form is.

There are two primary keys, so just using one gets me close but no
cigar!
 
J

Jeanette Cunningham

mmmmmmmmmm,
I haven't ever used 2 primary keys. Not sure how to get around this problem.
The combo can only have one column bound and that is the column that needs
to be set equal to the value of the primary key that the record is sitting
on. Maybe someone else will jump in and explain how to do it when there are
2 primary keys.

Jeanette Cunningham
 
A

anthony

On my form I have a combo which looks up a record in the underlying
table. The columns are ChildAOLTermID (primary key), PhotoID (primary
key) and a column with an amalgamation of fields eg [LastName] & ", "
& [FirstName] etc. The first two columns are set at 0 size and the
lookup is actually carried out using the third. I want to put
something in the current event of the form so that the combo reflects
the current record as I move back and forth through the records. I
imagined that:

Me.cboFindRecord.Column(0) = ChildAOLTermID AND
Me.cboFindRecord.Column(1) = PhotoID

might work but I get "Object required". I've played around with
various different approaches but as soon as I deploy .column, I get
the error. Both column(0) and column(1) need to be populated correctly
as together they form the unique record

Many thanks for your help

Anyone got an answer to this please?
 
D

Douglas J. Steele

anthony said:
On my form I have a combo which looks up a record in the underlying
table. The columns are ChildAOLTermID (primary key), PhotoID (primary
key) and a column with an amalgamation of fields eg [LastName] & ", "
& [FirstName] etc. The first two columns are set at 0 size and the
lookup is actually carried out using the third. I want to put
something in the current event of the form so that the combo reflects
the current record as I move back and forth through the records. I
imagined that:

Me.cboFindRecord.Column(0) = ChildAOLTermID AND
Me.cboFindRecord.Column(1) = PhotoID

might work but I get "Object required". I've played around with
various different approaches but as soon as I deploy .column, I get
the error. Both column(0) and column(1) need to be populated correctly
as together they form the unique record

Many thanks for your help

Anyone got an answer to this please?

You cannot set values through the Column collection.

You can only ensure that the bound column is set to a specific value.
 
A

anthony

As has been suggested elsewhere, I could do this basing the combo box
on a query which gives a calculated single
field containing ChildAOLTermID&PhotoID and then use that to set the
combo box as you move the current record
 

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