jeanvliet2012
New member
- Local time
- Today, 11:47
- Joined
- Aug 15, 2012
- Messages
- 8
Could someone tell me what's wrong with my zSQL string? I am working on it for 2 days and got no where. I want to put a IF statement (=IF('Report - key'!$B$7="ALL","ALL",'2012 data'!B2)) to a ACCESS Text field using SQL Update. Here is my code:
Dim zSQL As String
Dim zmsg As String
Dim DQ As String
DQ = """"
zSQL = "UPDATE Supplier_Meeting_Planning SET [ID3] = ' " & "=IF(" & "'" & "Report - key" & "'" & "!$B$7=" & DQ & "ALL" & DQ & "," & DQ & "ALL" & DQ & "," & "'" & "2012 data" & "'" & "!B2)"
Debug.Print zSQL
DoCmd.RunSQL zSQL
It is very painful to put ' and " in the string. Is there a easy way to do this? Your suggestion is greatly appreciate.
Jean
Dim zSQL As String
Dim zmsg As String
Dim DQ As String
DQ = """"
zSQL = "UPDATE Supplier_Meeting_Planning SET [ID3] = ' " & "=IF(" & "'" & "Report - key" & "'" & "!$B$7=" & DQ & "ALL" & DQ & "," & DQ & "ALL" & DQ & "," & "'" & "2012 data" & "'" & "!B2)"
Debug.Print zSQL
DoCmd.RunSQL zSQL
It is very painful to put ' and " in the string. Is there a easy way to do this? Your suggestion is greatly appreciate.
Jean
