| | |
Error: Type Mismatch - access + vb 6.0
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 0
I'm having this error: type mismatch.. i dont actually get/understand the error.. i think the error is in the WHERE clause [tblUserAccount].[UserID].. the field [UserID] is set to a data type Autonumber, and the roleUserID is set as integer..
help me out here please.. thanks
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Global rolesDbs as new adodb.connection Global rolesRs as new adodb.recordset rolesDbs.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & App.Path & "\library.mdb;MODE=ReadWrite" rolesDbs.CursorLocation = adUseClient Set rolesRs.ActiveConnection = rolesDbs rolesRs.LockType = adLockOptimistic rolesRs.CursorType = adOpenDynamic rolesRs.Source = "SELECT [tblRoles].[UserID], [tblRoles].[Role] " & _ "FROM [tblUserAccount] INNER JOIN [tblRoles] ON ([tblUserAccount].[UserID] = [tblRoles].[UserID]) " & _ "WHERE [tblUserAccount].[UserID] = " + roleUserID + "" rolesRs.Open , rolesDbs, , , adCmdText
help me out here please.. thanks
•
•
Join Date: Dec 2007
Posts: 252
Reputation:
Solved Threads: 27
try this
single quotes around roleuserid
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"WHERE [tblUserAccount].[UserID] = '" & roleUserID & "'"
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 0
•
•
•
•
try this
single quotes around roleuseridVisual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"WHERE [tblUserAccount].[UserID] = '" & roleUserID & "'"
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"WHERE [tblMembership].[UserID] ='" & Trim(roleUserID) & "'"
•
•
Join Date: Dec 2007
Posts: 252
Reputation:
Solved Threads: 27
if you are pulling data from one table only why use the join?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"SELECT UserID, Role FROM tblRoles where UserID = '" & roleUserID & "'"
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 0
•
•
•
•
in your query you are only pulling from one table. i guess its throwing me off. what are the fields from the other table you are using? can you test your query in your db's query analyser?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
"SELECT * FROM [tblMembership] WHERE [tblMembership].[UserID] = '"+ rolesUserID + "'"
if i remove the WHERE clause, i get no errors, but if place that WHERE clause in the Query it pops up the error: Type Mismatch. In the table Membership, i set the data type of UserID to Number, and the variable rolesUserID to Integer.
The rolesUserID is actually a variable that i have set to make a comparison to [tblMembership].[UserID].
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
rolesUserID = usersRs.Fields("UserID").Value
i dont know what's causing the problem.
Last edited by JerieLsky; Aug 19th, 2009 at 1:57 am.
![]() |
Similar Threads
- [Getting an error 'Data Type Mismatch in Criteria Expression] (VB.NET)
- run time error "13" type mismatch (Visual Basic 4 / 5 / 6)
- Run time error 13 - type mismatch (Visual Basic 4 / 5 / 6)
- accessing dates in ms access with visual basic (Visual Basic 4 / 5 / 6)
- Type mismatch: Cannot convert from void to double (Java)
- error: Type mismatch in redecleration on 'throw_cards' (C)
- subtract arrays type mismatch please help (Visual Basic 4 / 5 / 6)
- type mismatch in redeclaration of 'square' ( function ) (C)
- Type mismatch (ASP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Where to find VB?
- Next Thread: msflexgrid data trasfer to texbox
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






..