Combobox dropdown on every record change

Combobox dropdown on every record change

Post by Rey » Thu, 25 Sep 2003 13:21:32


Howdy, all.
Appreciate your help. Have a one to many relation between a client and
visit table.

In the visit subform, I have a visittype and counselor field which are
comboboxes. If I set either field to drop down via Me.dropdown in the
GotFocus event for the field, each time the client record changes the
visittype or counselor field drops down - only have the GotFocus event set
to one combobox at the moment - unless I move the cursor in the subform to a
different field, i.e. visitdate or visitreason.

I have not tried the onEnter event to see what happens there. Researched via
Google but did not find a response to the question...I'm coming from a
Paradox and VB background and am currently learning Access programming
w/V97.

Thanks in advance for your suggestions/help,

Rey
 
 
 

Combobox dropdown on every record change

Post by Pavel Roma » Fri, 26 Sep 2003 00:42:11

Ok, I see what's happening. Now, could you tell what do you *want* to happen?
If you don't want the dropdown to occur on record changes, set tab order
for the combo box to something other that 0 or 1 so that they don't get
focus immediately.

Pavel

 
 
 

Combobox dropdown on every record change

Post by Rey » Fri, 26 Sep 2003 04:24:55

Howdy, Pavel.
Thanks for your suggestion. Unfortunately, it won't work as there there are
5 fields in the subform but the first (visitnum) is set as no tab stop so
there are 4 tab stops only with visittype (1) and counselor (4). Also the
user enters the visit info in order of typem date, reasons, counselor.

What I want the combobox to do is dropdown when I arrive on field AND not
dropdown when I cycle through client records. BTW, this is Access97, if I
didn't mention it before.

The dropdown issue is that as I cycle through the client records, the
subform will drop down the visittype or counselor field depending on which
field I've uncommented the obj.dropdown code.

If I enter a new visit info and am in the Counselor field when I click the
Save btn AND then move to the next client record via the record selector,
the Counselor field will drop down. So I now have to move to the reason
field in the subform to remove the focus from the counselor field so that it
does not drop down on cycling through clients. If I move the cursor to the
first name field on the form from the counselor field, the counselor field
still drops down on cycling through clients. It also drops down if I click
on Save btn, which I have now modified to setfocus to first name field.

Even changing code to dropdown on enter vice gotfocus does the same. So
maybe the option is not to cause the combo to dropdown.

Hopefully this provides you more detail.

Thanks again,
Rey




happen?
 
 
 

Combobox dropdown on every record change

Post by Bob Quinta » Fri, 26 Sep 2003 06:58:00

"Rey" < XXXX@XXXXX.COM > wrote in



I think what you want is to dropdown when creating a new record and
not when scrolling through existing records on a form.

If this is so, use

if me.newrecord then [your combo name].dropdown
 
 
 

Combobox dropdown on every record change

Post by Pavel Roma » Fri, 26 Sep 2003 07:23:30

I see - if you move to next record right after using the self dropping
cb, it retains focus and self-drops immediately.
Try this simple approach:
In the form's Current event, set focus to another control that is not a
self-dropping combo box.
In the combo box GotFocus, make it drop down.
Works like a charm.
Cheers,
Pavel
 
 
 

Combobox dropdown on every record change

Post by Rey » Fri, 26 Sep 2003 08:49:55

Howdy, Bob.

Thanks for the suggestion. It worked great. Totally missed the new rec
relation - duh!

Also thanks again, Pavel for your suggestion. Tried it also.

Thanks again,

Rey
 
 
 

Combobox dropdown on every record change

Post by Bob Quinta » Fri, 26 Sep 2003 09:42:11

"Rey" < XXXX@XXXXX.COM > wrote in



I missed the new rec relation three or four times when I started
programming. :)

Bob Q.