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

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


"Scott_Brasted via AccessMonster.com" u56211@uwe wrote in message
news:9f3ac455d955b@uwe...
Jeanette,

I took out the line: Call cboMoveTo_AfterUpdate a while ago because it
turned
red in the code window and caused an error. The cbo still shows blank and
I
get the error mentioned above with the code I posted above with the error
message posted above.

Best,
Scott

Jeanette Cunningham wrote:
Hi Scott,
I assume that the combo now correctly shows the first item on its list
after
the form loads?
The error message comes when the next line of code runs
Call cboMoveTo_AfterUpdate


Is this what happens?
If the answer is yes, just comment out the line of code
Call cboMoveTo_AfterUpdate

and see how that goes.

That line of code was put in to simulate the user clicking the combo to
finding the records that match the SetupID for the first item on the list.
You may not need to do this.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Jeanette,

[quoted text clipped - 48 lines]
Thanks,
Scott


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