ProgrammerAndy
Programmer
here is my dilemia
I open a recordset and I need to determine if my value is numeric, date, or char. It works as long as I do not have a number in a text field. The statement sees this as a numeric value yet it is not. Any suggestions on how I tell the code to treat this as a text?
Oh yes, a wrench! I am using this if/else statement in a do loop, building a where clause for a SQL statement, being passed back to SQL 2000. So the value changes for letters to numbers and back again.
Code:
If IsNumeric(rst!WhereCriteria) Then
g_strSQLWhere = g_strSQLWhere & " " & rst!WhereCriteria
Else
If IsDate(rst!WhereCriteria) Then
g_strSQLWhere = g_strSQLWhere & " CONVERT(DATETIME, '" & rst!WhereCriteria & "' , 102) "
Else
g_strSQLWhere = g_strSQLWhere & " '" & CStr(rst!WhereCriteria) & "' "
End If
End If
I open a recordset and I need to determine if my value is numeric, date, or char. It works as long as I do not have a number in a text field. The statement sees this as a numeric value yet it is not. Any suggestions on how I tell the code to treat this as a text?
Oh yes, a wrench! I am using this if/else statement in a do loop, building a where clause for a SQL statement, being passed back to SQL 2000. So the value changes for letters to numbers and back again.
Code:
If IsNumeric(rst!WhereCriteria) Then
g_strSQLWhere = g_strSQLWhere & " " & rst!WhereCriteria
Else
If IsDate(rst!WhereCriteria) Then
g_strSQLWhere = g_strSQLWhere & " CONVERT(DATETIME, '" & rst!WhereCriteria & "' , 102) "
Else
g_strSQLWhere = g_strSQLWhere & " '" & CStr(rst!WhereCriteria) & "' "
End If
End If