Skip to content

Updated Function JoinString() to add mandatory parenthesis support on MS Access JOIN Query #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/ClassModules/SQLSelect.cls
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ End Function

Private Function JoinString()
Dim R As Long
Dim I As Long
Dim Lines() As String
Dim Line As String
Dim LineArray As Variant
Expand All @@ -236,7 +237,19 @@ Private Function JoinString()
If LineArray(3) <> "" Then
Line = Line & " ON " & LineArray(3)
End If
Lines(R) = Line
'Add inicial open parenthesis as needed join
If R = 0 And UBound(aJoin) > 1 Then
For I = 2 To UBound(aJoin)
Line = " ( " & Line
Next I
Lines(R) = Line
'Add close parenthesis for join
ElseIf R > 0 And R < UBound(aJoin) And UBound(aJoin) > 1 Then
Lines(R) = Line & " ) "
Else
'Normal output
Lines(R) = Line
End If
Next R
JoinString = Join(Lines, " ")
End Function
Expand Down