Hello:
I have been struggling with building a cascading list on a form that I created. My problem is that I am getting a "Datatype Mismatch in criteria expression" error that I can not seem to figure out. I hope someone can help...
The background is that I have two drop down boxes on a form called:
cboPolicyName
cboPolicyNumber
On the rowsource for the cboPolicyName I have it pointing to my table:
-
SELECT DISTINCT tblPolicyName.PolicyName, tblPolicyName.PolicyNameID FROM tblPolicyName ORDER BY tblPolicyName.PolicyName;
-
This works fine and the dropdown box populates with my various "Policy Names"
On the After update event of that same control I have the following:
-
Private Sub cboPolicyName_AfterUpdate()
-
'When the Policy Name is selected, the appropriate Policy Number region list will
-
'display in the drop down list of CboPolicyNumber
-
-
On Error Resume Next
-
cboPolicyNumber.RowSource = "Select tblPolicyNumber.PolicyNumber " & _
-
"FROM tblPolicyNumber " & _
-
"WHERE tblPolicyNumber.PolicyNameID = '" & cboPolicyName.Value & "' " & _
-
"ORDER BY tblPolicyNumber.PolicyNumber;"
-
End Sub
-
I set my cboPolicyNumber control rowsource to be blank.
I am new at doing these types of cascading lists but I have looked at how they are created and I believe I did everything right. For some reason, I believe the After Update is where the error is occurring. I have looked at everything I can think of, making sure that everything is bound on column 1 and that that column is numeric.
Does anybody have any ideas what I can check or where I am going wrong???
Thanks,
Keith.