unbound combo requery (1 Viewer)

kmb

Registered User.
Local time
Yesterday, 23:05
Joined
Oct 1, 2009
Messages
26
Hi all,
This is kind of a two parter...
Explanation:
I have an unbound combo box (organization) that's rowsource is a query where another combo (contact) on the form supplies a parameter. The query works correctly.

Problem 1:
I would like to display the first value from the combo's list. I have tried:
Code:
Me.cboOrg=Me.cboOrg.ItemData(0)
in the form's OnLoad event. This works for the first record, but leads to...

Problem 2:
The problem is, when I go to the next record, the combo box still only has the original list (from the first record).

I have tried requery, in the afterUpdate event for the form and for the contacts combobox.

BTW: I would use a bound combo for the organization name, but the form's query becomes uneditable because of a many to many relationship.


If this is not clear, feel free to let me know.
Thanks for any advice.
KmB
 

kmb

Registered User.
Local time
Yesterday, 23:05
Joined
Oct 1, 2009
Messages
26
Just so anyone that looks knows...I figured out a solution...although it may be a workaround...I won't be the judge;)

I included the following two lines of code into the gotFocus event of both combos on the subform and on all navigation buttons.
Code:
Me.OrgNameCombo.Requery
Me.OrgNameCombo = Me.OrgNameCombo.ItemData(0)
This works the way I need it to...but if anyone has a better solution let me know.
Thanks
KmB
 

Users who are viewing this thread

Top Bottom