By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Combo Boxes, Queries and Forms Oh My!

P: n/a

I have a form with two combo boxes. The value chosen in the first
combo box (cbo1) is supposed to change the values that appear in the
second combo box (cbo2). This currently works great for the first
record entered by the user (continuous forms). However in the second
record, cbo2 shows the values influenced by cbo1 in the first record,
rather than the 2nd record (i.e. it doesn't update).

My problem may be that both combo boxes have their Row Source as
queries, and query2 (for cbo2) is not updating after cbo1 gets filled
in the first time. How do I tell cbo2 to use the value from cbo1
current record, rather than first record? Do I need to use "me"? Do I
need to use VBA rather than the query, or run the query in some type of
"event"? Please provide detail as I'm not a VBA whiz.

Here is the SQL from cbo1 query:
SELECT [EQUIP LIST].EQUIP_NAME, [EQUIP LIST].STATUS
FROM [EQUIP LIST]
WHERE ((([EQUIP LIST].OBSOLETE)=0))
ORDER BY [EQUIP LIST].EQUIP_NAME;

And cbo2 query:
SELECT [PM CAL PROCEDURES].[PM DESCRIPTION], [PM CAL
PROCEDURES].EQUIP_NAME
FROM [PM CAL PROCEDURES]
WHERE ((([PM CAL
PROCEDURES].EQUIP_NAME)=[Forms]![frmRecordMorePM].[cboEquipList]));

Thanks!
Liana
Bend, Oregon

Jan 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Your 2nd query is a parameter query that gets its data based on whatever
is selected in the 1st combobox. In order for the 2nd Combobox to
repopulate with the correct data after a selection is made from the 1st
combobox, You need to requery the form. You can do this in the Click
event of the 1st combobox

Private Sub 1stCombo_Click()
Me.Requery
End Sub

Additionally, for data entry purposes, you may have better results with
a single form rather than a continuous form (go to form Design view -
select the form property sheet and select Single Form in the Default
View property).

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jan 26 '07 #2

P: n/a
You don't need to requery the whole form, only the 2nd combo control in the
after update event of the 1st

Me![2ndCombo].Requery

"Rich P" <rp*****@aol.comwrote in message
news:45*********************@news.qwest.net...
Your 2nd query is a parameter query that gets its data based on whatever
is selected in the 1st combobox. In order for the 2nd Combobox to
repopulate with the correct data after a selection is made from the 1st
combobox, You need to requery the form. You can do this in the Click
event of the 1st combobox

Private Sub 1stCombo_Click()
Me.Requery
End Sub

Additionally, for data entry purposes, you may have better results with
a single form rather than a continuous form (go to form Design view -
select the form property sheet and select Single Form in the Default
View property).

Rich

*** Sent via Developersdex http://www.developersdex.com ***

Jan 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.