troubleshooting Question

Searching MS Access Table and Getting An Error

Avatar of WonHop
WonHopFlag for United States of America asked on
DatabasesMicrosoft AccessVBA
17 Comments1 Solution93 ViewsLast Modified:
Hello All.  I need to loop thru  "tbl_Compiled_List_Working", get a Term.  Then find that Term in "tbl_Appendix_A_Working".
Every thing works fine until it tries to do the actual Search.

I get a "runtime error 3421 data type conversion error"

Both are "Short Text" in the tables.

Dim rsttblCompiledListWorking As Recordset
Dim rsttlAppendixAWorking As Recordset
Dim strtxtTermCLW As String
Dim strtxtDefinitionCLW As String

Dim db As Database

Set db = CurrentDb
Set rsttblCompiledListWorking = db.OpenRecordset("tbl_Compiled_List_Working", DB_OPEN_DYNASET)
Set rsttblAppendixAWorking = db.OpenRecordset("tbl_Appendix_A_Working", DB_OPEN_DYNASET)

rsttblCompiledListWorking.MoveLast
inttblCompiledListWorking = rsttblCompiledListWorking.RecordCount

intCount = 0

If inttblCompiledListWorking > 0 Then
    rsttblCompiledListWorking.MoveFirst
    Do Until rsttblCompiledListWorking.EOF = True
        strTermCLW = rsttblCompiledListWorking!txt_Term_CLW

        THIS IS WHERE THE ERROR MESSAGE HAPPENS,
        rsttblAppendixAWorking.OpenRecordset "Select * From tbl_Appendix_A_Working Where tbl_Appendix_A_Working.txt_Term_AAW = '" & strTermCLW & "'"
     
         Other code stuff
   Loop
End If
ASKER CERTIFIED SOLUTION
Mark Edwards
Chief Technology Officer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros