| | |
error on refresh
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2006
Posts: 29
Reputation:
Solved Threads: 0
I am trying to refresh a data control but I keep getting the following message no matter what I try:
Run-time error 3464
Data type mismatch in criteria expression.
If I leave the where clause out I don't get the error message.
Please help.
Run-time error 3464
Data type mismatch in criteria expression.
If I leave the where clause out I don't get the error message.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdseektask_Click() Dim strsql As String, temp As Long Let temp = InputBox("enter a bidnumber:") Let strsql = "SELECT * from bids where bidno ='" & temp & "'" Let datbids.RecordSource = strsql datbids.Refresh End Sub
Please help.
Last edited by Comatose; Sep 20th, 2006 at 10:23 pm.
Let strsql = "SELECT * from bids where bidno ='" & temp & "'" is not the solution, try something like:strsql = "SELECT * from bids where bidno = " & chr(34) & chr(34) & temp & chr(34) & "'" & chr(34)EDIT: Nevermind, I totally missed the mark on that one! :eek: try something like this (I don't know what bidno is supposed to be, either an integer, or a long, or a double, or what):
Let strsql = "SELECT * from bids where bidno ='" & cint(temp) & "'" Last edited by Comatose; Sep 20th, 2006 at 10:30 pm.
•
•
Join Date: Aug 2006
Posts: 29
Reputation:
Solved Threads: 0
•
•
•
•
Let strsql = "SELECT * from bids where bidno ='" & temp & "'"is not the solution, try something like:
strsql = "SELECT * from bids where bidno = " & chr(34) & chr(34) & temp & chr(34) & "'" & chr(34)
EDIT: Nevermind, I totally missed the mark on that one! :eek: try something like this (I don't know what bidno is supposed to be, either an integer, or a long, or a double, or what):
Let strsql = "SELECT * from bids where bidno ='" & cint(temp) & "'"
[Private Sub cmdscroll_click()
Set dbsbidinfo = OpenDatabase("c:\testdatabase\db3.mdb")
Set rstbidinfo = _
dbsbidinfo.OpenRecordset("bidtest", dbOpenDynaset)
Dim strsql As String
' Let strsql = "select * from bidtest"
Let strsql = "SELECT * from bidtest where bidnumber ='" & CInt(temp) & "'"
Let dattestbids.RecordSource = strsql
dattestbids.Refresh
End Sub]
The code works until I put in the where clause. When I put the where clause in I get the message : "data type mismatch in criteria expression"
Can you help me with this?
Remove the Single Quotes from the criteria expression. It should be
Single Quotes are used for String & Date Datatypes, Not Numbers. Also since you have declared temp as a Long, u shouldn't use CInt. For safety sake, u can use
temp = val(InputBox("...."))
Also you should check if the user has input a number by using IsNumeric Function.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Let strsql = "SELECT * from bidtest where bidnumber = " & CInt(temp)
Single Quotes are used for String & Date Datatypes, Not Numbers. Also since you have declared temp as a Long, u shouldn't use CInt. For safety sake, u can use
temp = val(InputBox("...."))
Also you should check if the user has input a number by using IsNumeric Function.
Last edited by aparnesh; Sep 25th, 2006 at 3:09 pm.
![]() |
Similar Threads
- Page Cannot Be Found Error in IE- refresh fixes (Viruses, Spyware and other Nasties)
- Strange IE problems (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Problem in Serial Communication In Visual Basic
- Next Thread: VB/word 2000/template forms
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append 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 table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






