Search code examples
vbatypesmismatch

VBA Editor Data type mismatch


I keep getting a "data type mismatch" when running this in access 2007,

I've been looking at it for a while and cannot figure it out.

Private Sub Combo7_AfterUpdate()
    Dim clString As Integer
    clString = Me![Combo7].Value
    strSQL = "SELECT [Categorized Tables].[Name of Table] " & _
             "INTO [catTemp] " & _
             "FROM [Categorized Tables] " & _
             "WHERE [Categorized Tables].[Category] = " & clString
    DoCmd.SetWarnings False
    DoCmd.RunSQL strSQL
    DoCmd.SetWarnings True
End Sub

The debugger points to the DoCmd.RunSQL strSQL line.

Anyone have an Idea of where I am going wrong?


Solution

  • Answer by Siddharth Rout:

    "Try this clString = Val(Me![Combo7].Value)"