query_executed = "SELECT p.FBN, p.Car_Number, p.Car_Title, p.Car_Type, p.Owner car_owner, p.open_closed as Car_Status, p.Car_Status as Status, p.Car_Date_Approved, p.date_submitted_for_approval, p.Expires_After as ""Car Expire"", "& _
"p.Site, p.Car_Lines, p.Capex, p.PO_Committed, p.PO_Invoiced, p.Cluster "& _
"FROM cobrarawdata.mcl_carline p "& _
"WHERE "& UserDefinedFilters & _
"AND (p.Capex > 0 OR p.PO_Committed > 0); "
I have that SQL query which is part of an excel vba used for reporting.
I have a request that we log all of the queries being executed. So I am attempting the following:
#If Mac Then
Sql = "INSERT INTO cobrarawdata.sssr_access_logging (username, event_datetime, event_type, query_executed) VALUES('"& LCase(Environ("USER")) & "','"& Format(Now(), "MM/dd/yyyy HH:mm:ss") & "','CAR Balance Query','"& query_executed & "')"
ExecuteSql (Sql)
#Else
Sql = "INSERT INTO cobrarawdata.sssr_access_logging (username, event_datetime, event_type, query_executed) VALUES('"& LCase(Environ("Username")) & "','"& Format(Now(), "MM/dd/yyyy HH:mm:ss") & "','CAR Balance Query','"& query_executed & "')"
ExecuteSql (Sql)
#End If
I am receiving an error though when I try and use the query_executed in the insert query and I haven't been able to get any amount of jockeying with double quotes to change that.