Setting the focus

G

Guest

My form is composed of one combo box and multiple other text boxes all pulled
from the same table. When i pick an item from my combo box the text boxes
will all change to the corresponding records. The problem is that if i
scroll down or up with my mouse the text records change but the record in my
combo box remains unchanged. Is this a problem concerning focussing? Thank
you to whoever can answer this for me.
 
T

tina

well, presumably the combo box control is unbound (the ControlSource
property is blank), and has code running on its' AfterUpdate event to "find"
the correct record on the form. the combo box is not actually connected to
the data records at all, so if you want the selection in the combo box
control to change as you move from record to record, you'll need to write
code to do that. in the form's Current event procedure, you can add code to
set the value of the combo box control; something along the lines of

Me!ComboBoxControlName = Me!PrimaryKeyFieldName

substitute the correct names, of course.

hth
 
G

Guest

When i view the properties of the combo box it lists the name "Combo95", is
this what i should use for my combo box control name, and what should i use
for my primary key field name? Sorry if my questions seem a bit elementary.
 
T

tina

Economics said:
When i view the properties of the combo box it lists the name "Combo95", is
this what i should use for my combo box control name,
yes.

and what should i use
for my primary key field name? Sorry if my questions seem a bit
elementary.

open the form in design view. click on the combo box control to select it.
in the Properties box, click on the Event tab. look for a line that says
[Event Procedure]
it's probably on the AfterUpdate line. once you find it, click on the line
and you'll see a Build button (...) at the right side. click that button.
the VBA Editor window will open to the code for that event. highlight the
*entire* procedure (it will start with "Private Sub" and end with "End
Sub"). copy the procedure and paste it into a post so we can see it. from
the posted code, i'll be able to tell you what fieldname to use.

hth
 

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