Shred Dude
03-15-2011, 02:11 PM
When writing SQL statements in VBA procedures that will use them to open recordsets via ADO, any advice on syntax.
For example, If I create a query in Access and copy the Resulting SQL to my VBA procedure it may look something like this:
sSQL = "SELECT A.[xxx], B.[yyy], A.[zzz] " & _
"FROM tblAlpha A INNER JOIN tblBeta B ON A.[ID] = B.[ID];"
Any advantage over using the Join statement as compared to something like this:
sSQL = "SELECT A.[xxx], B.[yyy], A.[zzz] " & _
"FROM tblAlpha A, tblBeta B " & _
"WHERE A.[ID] = B.[ID];"
I'm looking at building a routine to construct the needed SQL based on some User selections/actions and was hoping to nail down a syntax that would be easy to logically construct based on the state of the user interface when requested.
For example, If I create a query in Access and copy the Resulting SQL to my VBA procedure it may look something like this:
sSQL = "SELECT A.[xxx], B.[yyy], A.[zzz] " & _
"FROM tblAlpha A INNER JOIN tblBeta B ON A.[ID] = B.[ID];"
Any advantage over using the Join statement as compared to something like this:
sSQL = "SELECT A.[xxx], B.[yyy], A.[zzz] " & _
"FROM tblAlpha A, tblBeta B " & _
"WHERE A.[ID] = B.[ID];"
I'm looking at building a routine to construct the needed SQL based on some User selections/actions and was hoping to nail down a syntax that would be easy to logically construct based on the state of the user interface when requested.