Cascading Combo boxes

G

Guest

Ok i have a combo and list box, when i select one value from combo1, it then
populates list1 with specific values. This works fine. The problem that i
have is what is happening on form. When using the navigational buttons,
usually when you get to the end of the table and there is not more data to
view, access will come up with the message 'Cannot go to Specified Record'.
Only this is not happenin, when i click next, it jus creats a blank record
and keeps doing it. I dont want it to do this, i want it to display the error
message when i get to the end of the table only it isnt. It has something to
do with the combo box or list box but i cant figure out what it is. Can
someone help me?

This is the combobox and form coding

**************************************
Private Sub Combo32_AfterUpdate()

On Error Resume Next
List38.RowSource = "Select ScoutGuidesUnit.Unit2 " & _
"FROM ScoutGuidesUnit " & _
"WHERE ScoutGuidesUnit.Unit1 = '" & Combo32.Value & "' " & _
"ORDER BY ScoutGuidesUnit.Unit2;"

End Sub

**************************************
To update the list box when the combo box has been used
********************************************

Private Sub Form_Current()

On Error Resume Next
' Synchronise country combo with existing city
Combo32 = DLookup("[Unit1]", "ScoutGuidesUnit", "[Unit2]='" &
List38.Value & "'")
' Synchronise city combo with existing city
List38.RowSource = "Select ScoutGuidesUnit.Unit2 " & _
"FROM ScoutGuidesUnit " & _
"WHERE ScoutGuidesUnit.Unit1 = '" & Combo32.Value & "' " & _
"ORDER BY ScoutGuidesUnit.Unit2;"
 
G

Guest

The code in the OnCurrent event, I can't undestand why do you need to set the
value in the combo based on the list box, and then update the list box based
on the combo box?
 
G

Guest

Hahaha, thats embarassing. I didnt even think of that. I commented it out and
it works great, Thankyou!

Ofer Cohen said:
The code in the OnCurrent event, I can't undestand why do you need to set the
value in the combo based on the list box, and then update the list box based
on the combo box?



--
Good Luck
BS"D


b_a_redman said:
Ok i have a combo and list box, when i select one value from combo1, it then
populates list1 with specific values. This works fine. The problem that i
have is what is happening on form. When using the navigational buttons,
usually when you get to the end of the table and there is not more data to
view, access will come up with the message 'Cannot go to Specified Record'.
Only this is not happenin, when i click next, it jus creats a blank record
and keeps doing it. I dont want it to do this, i want it to display the error
message when i get to the end of the table only it isnt. It has something to
do with the combo box or list box but i cant figure out what it is. Can
someone help me?

This is the combobox and form coding

**************************************
Private Sub Combo32_AfterUpdate()

On Error Resume Next
List38.RowSource = "Select ScoutGuidesUnit.Unit2 " & _
"FROM ScoutGuidesUnit " & _
"WHERE ScoutGuidesUnit.Unit1 = '" & Combo32.Value & "' " & _
"ORDER BY ScoutGuidesUnit.Unit2;"

End Sub

**************************************
To update the list box when the combo box has been used
********************************************

Private Sub Form_Current()

On Error Resume Next
' Synchronise country combo with existing city
Combo32 = DLookup("[Unit1]", "ScoutGuidesUnit", "[Unit2]='" &
List38.Value & "'")
' Synchronise city combo with existing city
List38.RowSource = "Select ScoutGuidesUnit.Unit2 " & _
"FROM ScoutGuidesUnit " & _
"WHERE ScoutGuidesUnit.Unit1 = '" & Combo32.Value & "' " & _
"ORDER BY ScoutGuidesUnit.Unit2;"
 

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