Okay, I'm sorry, but I lied. I need to ask one more question regarding my database. This has to do with the three cascading combo boxes mentioned in my original question. I mimicked my way through creating three cascading combo boxes from solutions to questions others asked. They work great for the most part, even though I don't really understand why or how they work. However, there is one problem.
I need to be able to choose a blank for the second or third combo box if there are no applicable choices available for those companies, which happens often. For example, if there are no division choices for the second combo box and I pick the blank, upon tabbing to the third combo box, I get a error popup that says, “Syntax error (missing operator) in query expression ‘[DivisionName]=’
And if there are no choices applicable for the third combo box [cboLocations], the dropdown list shows choices from the last entry that did have choices even though they are not applicable. I need both combo boxes to allow me to choose a blank choice if that is the appropriate answer for that company. Below is what I currently have:
Is it possible to fix this problem? Please, please help again!
**Edit**
This new question has been split from How to combine five data fields into one string for a new field.
I need to be able to choose a blank for the second or third combo box if there are no applicable choices available for those companies, which happens often. For example, if there are no division choices for the second combo box and I pick the blank, upon tabbing to the third combo box, I get a error popup that says, “Syntax error (missing operator) in query expression ‘[DivisionName]=’
And if there are no choices applicable for the third combo box [cboLocations], the dropdown list shows choices from the last entry that did have choices even though they are not applicable. I need both combo boxes to allow me to choose a blank choice if that is the appropriate answer for that company. Below is what I currently have:
Code:
Private Sub cboCustomers_AfterUpdate()
' Update the row source of the cboDivisions combo box
' when the user makes a selection in the cboCustomers
' combo box.
Me.cboDivisions.RowSource = "SELECT DivisionName FROM" & _
" DivisionTable WHERE Customers = " & _
Me.cboCustomers & _
" ORDER BY DivisionName"
Me.cboDivisions = Me.cboDivisions.ItemData(0)
Me.cboDivisions.Requery
Me.Customer = Me.cboCustomers.Column(1)
End Sub
Private Sub txtSendKeys_GotFocus()
Private Sub cboDivisions_AfterUpdate()
With Me![cboLocations]
If IsNull(Me!cboDivisions) Then
.RowSource = ""
Else
.RowSource = "SELECT [Locations] FROM LocationsTable WHERE [DivisionName]=" & _
DLookup("[DivID]", "DivisionTable", "[DivisionName] = '" & Me![cboDivisions] & "'")
End If
Call .Requery
End With
End Sub
**Edit**
This new question has been split from How to combine five data fields into one string for a new field.
Comment