Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch error

Status
Not open for further replies.

cc5305

MIS
Oct 4, 2000
70
US
When I run a SQL from my code and try to set the value retrieved back to a recordset. I keep getting the Type Mismatch error. Can someone enlighten me abou this? I've already checked to make sure that the field type are not conflicting or anything. But I can't tell what I'm missing. Thanks in advance.
 
here is how I have the code in the program:

'Option Explicit
dim rsOrgTotal as Recordset
dim strGetInfoSQL as String

strGetInfoSQL = "SELECT Total, org_level FROM "
strGetInfoSQL = strGetInfoSQL + "tbl_org_level_total ORDER BY org_level;"

Set rsOrgTotal = db.OpenRecordset(strGetInfoSQL, dbOpenDynaset)

when it gets to the set statment, the Type Mismatch error pops up. Thanks.
 
Hi, try like this

'Option Explicit
Dim rsOrgTotal As Recordset
Dim strGetInfoSQL As String

strGetInfoSQL = "SELECT Total, org_level FROM " & _
"tbl_org_level_total ORDER BY org_level;"

Set rsOrgTotal = db.OpenRecordset(strGetInfoSQL)

Best Regards

---
JoaoTL
mail@jtl.co.pt
MS Access Site: The Page: moved to
 
I've tried that already, still the same result. I've already added the DAO components, is there other ones I need to add? Thanks.
 
What Data Type is Total and OrgLevel?

Try This

strGetInfoSQL = "SELECT tbl_org_level_total.Total,tbl_org_level_total.org_level FROM " & _
"tbl_org_level_total ORDER BY tbl_org_level_total.org_level;"
Best Regards

---
JoaoTL
mail@jtl.co.pt
MS Access Site: The Page: moved to
 
Does the ActiveX component affect this? I know this question is weird, but as soon as I took it off in VB Editor, the darn thing worked fine.
 
Ok, i think there is no problem at all with the SQL, assuming that you have no Date or Time Data Types, try to Compact and Repair your DB and turn on the activeX. If dont work Turn Off the ActiveX and try again.

Say something Best Regards

---
JoaoTL
mail@jtl.co.pt
MS Access Site: The Page: moved to
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top