Format character function

xiaoxiao2021-04-01  235

Original location: http: //dev.9cbs.net/author/fanpingli/1742be883708457999b0ad569b82c878.html

Function Q (Byval Sqlvariable As Variant) AS String '--------------------------------------- - 'Notes: Useful in Creating Properly Formatted SQL Statements' usage: SQL = "SELECT * from Table where name =" & q (vntname)' ?? version of the version is suitable for access to Access, if other than other? Or? Do you need? Does it? Change '-----------------------------------------

ON Error Goto Ertrapq = Sqlvariable'Format The String Select Case Vartype (Sqlvariable) Case VBNULL, VBEMPTY Q = "Null" Case VBString Q = "'" & Replace (Sqlvariable, "'", "'") & "'" 'date variable Case vbDate' format and enclose in pounds signs for Access Q = " '" & Format $ (SqlVariable, "general date") & "'" 'otherwise treat as numeric Case Else On Error Resume Next Q = CStr (SqlVariable ) If err.number <> 0 THEN Q = SQLVARIABLE END SELECT EXIT FUNCTION

Errtrap: On Error Goto 0nd Function

转载请注明原文地址:https://www.9cbs.com/read-131047.html

New Post(0)