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:
[code=sql]
SELECT DISTINCT tblPolicyName.P olicyName, tblPolicyName.P olicyNameID FROM tblPolicyName ORDER BY tblPolicyName.P olicyName;
[/code]
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:
[code=vb]
Private Sub cboPolicyName_A fterUpdate()
'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.V alue & "' " & _
"ORDER BY tblPolicyNumber .PolicyNumber;"
End Sub
[/code]
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.
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:
[code=sql]
SELECT DISTINCT tblPolicyName.P olicyName, tblPolicyName.P olicyNameID FROM tblPolicyName ORDER BY tblPolicyName.P olicyName;
[/code]
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:
[code=vb]
Private Sub cboPolicyName_A fterUpdate()
'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.V alue & "' " & _
"ORDER BY tblPolicyNumber .PolicyNumber;"
End Sub
[/code]
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.
Comment