Using a Combo Box to Find Records

J

Jeanette Cunningham

In that case, it might be safer to use
Me.cboMoveTo = Me.SetupID

instead of

Me.cboMoveTo = Me.cboMoveTo.ItemData(1)


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Scott_Brasted via AccessMonster.com said:
OK, I woke up this mornng withyet another idea. This
time it was a good one. I took Jeanette's code and replaced the
Me.[cboMoveTo]
= Me.[cboMoveTo].ItemData(0) with Me.[cboMoveTo] =
Me.[cboMoveTo].ItemData(1)
ans voila, magic and all that. Simple is great.

Mant thanks for for the persistance.

Best,
scott



Jeanette said:
That combo searches using SetupID.
From reading through all your previous posts, I assume that the primary
key
of the form is something other than SetupID.
For the code line with ItemData(0) to work, the combo must search on the
primary key field of the form.

However, if the form has only value for SetupID when it opens,
you could try code like this-->
Me.cboMoveTo = Me.SetupID

Put that one line of code in the Form_Load event.

If the form has more than one value for SetupID when it opens, the code
above won't work. If it doesn't work, leave the combo blank when the form
opens.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Jeanette,
[quoted text clipped - 32 lines]
Thanks,
Scott
 

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