If this question should be posted in the VBA Coding forum, please let me know and I'll repost it there.
I am trying to do a select statement on three tables using the following code.
----------
Dim strSQL as string
Dim rsDataProp As Recordset
strSQL = "SELECT luc, description, units, view, "
strSQL = strSQL & "unittype, notes "
strSQL = strSQL & "FROM land AS dl "
strSQL = strSQL & "LEFT JOIN landuse AS lu ON (dl.luc = lu.code "
strSQL = strSQL & "LEFT JOIN landunit AS tlu ON (dl.units = tlu.code "
strSQL = strSQL & "WHERE dl.account = " & ??????????
strSQL = strSQL & " AND dl.card = " & ?????????
strSQL = strSQL & " AND seqnumber = 1"
Set rsDataProp = db.OpenRecordset(strSQL)
----------
When I run this code I receive a syntax error(missing operator) after the "ON (dl.luc = tlu.code)" code.
I know it has something to do with the parentheses around the join statements. I checked and tried a couple of suggestions that I found here on tek-tips.com but for some reason I just can't put it together.
For the time being I have broken it out into separate statements with there own recordsets but I would like to try to make this technique work.
Any help or suggestions would be appreciated.
I am trying to do a select statement on three tables using the following code.
----------
Dim strSQL as string
Dim rsDataProp As Recordset
strSQL = "SELECT luc, description, units, view, "
strSQL = strSQL & "unittype, notes "
strSQL = strSQL & "FROM land AS dl "
strSQL = strSQL & "LEFT JOIN landuse AS lu ON (dl.luc = lu.code "
strSQL = strSQL & "LEFT JOIN landunit AS tlu ON (dl.units = tlu.code "
strSQL = strSQL & "WHERE dl.account = " & ??????????
strSQL = strSQL & " AND dl.card = " & ?????????
strSQL = strSQL & " AND seqnumber = 1"
Set rsDataProp = db.OpenRecordset(strSQL)
----------
When I run this code I receive a syntax error(missing operator) after the "ON (dl.luc = tlu.code)" code.
I know it has something to do with the parentheses around the join statements. I checked and tried a couple of suggestions that I found here on tek-tips.com but for some reason I just can't put it together.
For the time being I have broken it out into separate statements with there own recordsets but I would like to try to make this technique work.
Any help or suggestions would be appreciated.