Leo_Polla_Psemata
Registered User.
- Local time
- Yesterday, 23:12
- Joined
- Mar 24, 2014
- Messages
- 364
Hi everyone
I have found and created the below code in which we can convert an sql statement to VBA.
I have added my owb line which i just want to replace the '
' S = Replace(S, "'", """")
Now, the question is , if we have a very very long sql statement, how could we break it into more lines by adding the " & _
In the attached, there is a form with two fields, we paste sql in the first, click, we see the conversion on the second field
Code source
I have found and created the below code in which we can convert an sql statement to VBA.
I have added my owb line which i just want to replace the '
' S = Replace(S, "'", """")
Now, the question is , if we have a very very long sql statement, how could we break it into more lines by adding the " & _
Code:
Private Sub Status(S As String)
StatusBox = S & vbNewLine & StatusBox
DoEvents
End Sub
Private Sub Cnvre_Click()
Dim S As String
StatusBox = ""
S = SQLtext
S = Replace(S, """", """""")
Private Sub Status(S As String)
StatusBox = S & vbNewLine & StatusBox
DoEvents
End Sub
Private Sub Cnvre_Click()
Dim S As String
StatusBox = ""
S = SQLtext
S = Replace(S, """", """""")
' S = Replace(S, "'", """")
S = Replace(S, vbNewLine, """ & _ " & vbNewLine & vbTab & vbTab & """")
S = "Me.RecordSource = """ & S & """"
Status S
StatusBox.SetFocus
DoCmd.RunCommand acCmdCopy
End Sub
In the attached, there is a form with two fields, we paste sql in the first, click, we see the conversion on the second field
Code source
Attachments
Last edited: