0

Hi

I have the following code which generates an error 'Data Type mismatch in criteria expression'

The purpose of the code is to write a value to a database at a specific row.

Dim IntSid As String
        Dim Sid As String
        Dim I As Integer
        
        IntSid = Me.TTIn.Text
        Sid = Me.SessionIDTextBox.Text
        I = CInt(Val(Sid))


        Dim loSQL = "UPDATE tblSession SET TTout = '" & _
        IntSid & "' WHERE SessionId = '" & _
        I & " ' "
3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by debasisdas
0

It looks like you never declared the datatype of loSQL.

Hi

I got it to work the problem was the single quote around the variable I which is an Integer and not a String

My original SQL statement was

Dim loSQL = "UPDATE tblSession SET TTout = '" & _
        IntSid & "' WHERE SessionId = '" & _
        I & " ' "

This should have been

Dim loSQL = "UPDATE tblSession SET TTout = '" & _
        Me.TTIn.Text & "'WHERE SessionId = " & _
        I & " "

ViRi

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.