I am using Access 2000, and calling a form that will (eventually) display a string concatenated summary of a record in a text box.
However when I open the form, I keep getting "Run-time Error '13': Type mismatch", and the "set rs = db.OpenRecordset ...." line below is highlighted. All other code I have commented out to aid in troubleshooting. I've perused the forum and I have already added the Microsoft DAO 3.6 Object Library as a Reference (and ADO is not checked), and restarted Access. I've spent three hours trying to figure this out, I would appreciate any suggestions.
I'm new to writing VB code, but this just feels like there should be a simple cause.
********* BEGIN CODE ***********
Private Sub Form_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT Frame_CircuitID FROM tbCircuits_Frame WHERE Site_Code = '" & Forms!fmSiteDetail.txtSiteCode & "'"
End Sub
********* END CODE *************
If it will help anyone answer my question, the Frame_CircuitID is the primary key in the tbCircuits_Frame table. Site_Code is also a text field in the Frame_CircuitID table. I've also replaced the where clause with a literal value with the same results.
However when I open the form, I keep getting "Run-time Error '13': Type mismatch", and the "set rs = db.OpenRecordset ...." line below is highlighted. All other code I have commented out to aid in troubleshooting. I've perused the forum and I have already added the Microsoft DAO 3.6 Object Library as a Reference (and ADO is not checked), and restarted Access. I've spent three hours trying to figure this out, I would appreciate any suggestions.
I'm new to writing VB code, but this just feels like there should be a simple cause.
********* BEGIN CODE ***********
Private Sub Form_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT Frame_CircuitID FROM tbCircuits_Frame WHERE Site_Code = '" & Forms!fmSiteDetail.txtSiteCode & "'"
End Sub
********* END CODE *************
If it will help anyone answer my question, the Frame_CircuitID is the primary key in the tbCircuits_Frame table. Site_Code is also a text field in the Frame_CircuitID table. I've also replaced the where clause with a literal value with the same results.