View Single Post
  #21  
Old November 17th, 2009, 08:07 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Using a Combo Box to Find Records

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" u56211@uwe wrote in message
news:9f3fcce915429@uwe...
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 Cunningham wrote:
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


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1