Christine Pearc
Christine
- Local time
- Today, 13:55
- Joined
- May 13, 2004
- Messages
- 111
Hi, Gang.
For my life, I can’t get my dependent combo boxes to work, despite looking at downloaded samples and reading every thread here and elsewhere. Could someone take a look and tell me what’s wrong:
What needs to happen is this: When the user selects a CauseCategory in one combo box, only the CauseCodes associated with the Cause Category appear in the CauseCode field. Note that I want both the CauseCategoryID and CauseCodeID to be stored in the table, so this is why I’ve used bound controls for each field.
TBLCAUSECATEGORIES
Fields: CauseCategoryID (AutoNumber) and CauseCatDesc (Text)
TBLCAUSES
Fields: CauseCode (AutoNumber), CauseDesc )(Text), CauseCategoryID (Number)
There is a relationship between CauseCategoryID in both tables.
On the data entry form, there are the following fields:
CauseCategoryID. This combo box gets its info from a query, shown below. Column count = 2; Bound Column = 1 (the AutoNum ID)
SELECT tblCauseCategories.CauseCategoryID, tblCauseCategories.CauseCatDesc FROM tblCauseCategories;
The After Update procedure for CauseCategoryID is:
Private Sub CauseCategoryID_AfterUpdate()
On Error Resume Next
CauseCodeID.RowSource = "SELECT tblCauseCodes.CauseCodeID " & _
"FROM tblCauseCodes " & _
"WHERE tblCauseCodes.CauseCategoryID = '" & CauseCategoryID.Value & "' " & _
"ORDER BY tblCauseCodes.CauseCodeID;"
End Sub
Nothing happens, or sometimes after playing around with the code a bit I get “Data Type Mismatch in Criteria Expression”
This should be SOOOO simple. What’s wrong?
Ta,
Christine
For my life, I can’t get my dependent combo boxes to work, despite looking at downloaded samples and reading every thread here and elsewhere. Could someone take a look and tell me what’s wrong:
What needs to happen is this: When the user selects a CauseCategory in one combo box, only the CauseCodes associated with the Cause Category appear in the CauseCode field. Note that I want both the CauseCategoryID and CauseCodeID to be stored in the table, so this is why I’ve used bound controls for each field.
TBLCAUSECATEGORIES
Fields: CauseCategoryID (AutoNumber) and CauseCatDesc (Text)
TBLCAUSES
Fields: CauseCode (AutoNumber), CauseDesc )(Text), CauseCategoryID (Number)
There is a relationship between CauseCategoryID in both tables.
On the data entry form, there are the following fields:
CauseCategoryID. This combo box gets its info from a query, shown below. Column count = 2; Bound Column = 1 (the AutoNum ID)
SELECT tblCauseCategories.CauseCategoryID, tblCauseCategories.CauseCatDesc FROM tblCauseCategories;
The After Update procedure for CauseCategoryID is:
Private Sub CauseCategoryID_AfterUpdate()
On Error Resume Next
CauseCodeID.RowSource = "SELECT tblCauseCodes.CauseCodeID " & _
"FROM tblCauseCodes " & _
"WHERE tblCauseCodes.CauseCategoryID = '" & CauseCategoryID.Value & "' " & _
"ORDER BY tblCauseCodes.CauseCodeID;"
End Sub
Nothing happens, or sometimes after playing around with the code a bit I get “Data Type Mismatch in Criteria Expression”
This should be SOOOO simple. What’s wrong?
Ta,
Christine