G
Guest
I'm trying to build a FROM clause from code, depending on the choices taken
in a form with multiple controls. Basically, it goes like this (hypothetical
names):
if ctl1.value = true then
fromsql = "FROM TABLE1 INNER JOIN ON TABLE1.FIELD1 = ROOT.FIELD1"
end if
if ctl2.value = true then
fromsql = fromsql & "TABLE 2 INNER JOIN ON TABLE2.FIELD2 = ROOT.FIELD2"
This is where my problem begins, since a proper FROM statement has to have
other innerjoin statments placed in the first (eg. from TABLE1 inner join
(TABLE2 inner join (TABLE3 inner join on TABLE3.FIELD3 = ROOT.FIELD3) on
TABLE2.FIELD2 = ROOT.FIELD2) on TABLE1.FIELD1 = ROOT.FIELD1.
Therefore, in order for me to do this, i think i need to insert the second
statement into the middle of the first, but I dont know how...
Please advise,
Thanks,
in a form with multiple controls. Basically, it goes like this (hypothetical
names):
if ctl1.value = true then
fromsql = "FROM TABLE1 INNER JOIN ON TABLE1.FIELD1 = ROOT.FIELD1"
end if
if ctl2.value = true then
fromsql = fromsql & "TABLE 2 INNER JOIN ON TABLE2.FIELD2 = ROOT.FIELD2"
This is where my problem begins, since a proper FROM statement has to have
other innerjoin statments placed in the first (eg. from TABLE1 inner join
(TABLE2 inner join (TABLE3 inner join on TABLE3.FIELD3 = ROOT.FIELD3) on
TABLE2.FIELD2 = ROOT.FIELD2) on TABLE1.FIELD1 = ROOT.FIELD1.
Therefore, in order for me to do this, i think i need to insert the second
statement into the middle of the first, but I dont know how...
Please advise,
Thanks,