by Jeff Schnarel (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 29th August 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Preps multiple type values used by an SQL String for insertion into a database field
API Declarations
Public Enum utFieldSuffix
utQuotes = 1
utQuoteComma = 2
End Enum
varBefore As Variant, _
Optional AddQuote As utFieldSuffix = 0) As String
If IsNull(varBefore) Then
Var2Fld = " NULL "
ElseIf VarType(varBefore) = vbString Then
Var2Fld = Trim$(Replace(CStr("" & varBefore), "'", "''"))
If AddQuote = 2 Then
Var2Fld= " '" & Var2Fld & "', "
Else
Var2Fld = " '" & Var2Fld & "' "
End If
Else
If AddQuote = 2 Then
Var2Fld = " " & CStr(varBefore) & ", "
End If
End If
End Function
No comments have been posted about Preps multiple type values used by an SQL String for insertion into a database field. Why not be the first to post a comment about Preps multiple type values used by an SQL String for insertion into a database field.