I'm trying to compile the below code, however something seems wrong and I can't tell what... can some one tell me whats wrong?
The error I'm receiving is "end of statement error".
Update: sqlqry points to a sql code here, which is copied from an Access query and the code itself runs fine in Access so no need to exam the integrity of the code. The compile error here has something to do with quotations, parenthesis or other symbol (i'm pretty sure)
Thanks so much!
code here:
The error I'm receiving is "end of statement error".
Update: sqlqry points to a sql code here, which is copied from an Access query and the code itself runs fine in Access so no need to exam the integrity of the code. The compile error here has something to do with quotations, parenthesis or other symbol (i'm pretty sure)
Thanks so much!
code here:
Code:
Dim sqlstr = string
sqlqry = "INSERT INTO [TBL_Product-SD] ( Product_SDAmt, Loc_Ff, Gender, Ft, age, CT_Code )" _
& "SELECT [Tbl Amt-SD].Amt, [Tbl LocFf-SD]![Loc] & " (" & [Tbl LocFf-SD]![Ff] & ") " _
& "" AS Loc_Ff, [Tbl Amt-SD].GDR, [Tbl Amt-SD].FA, [Tbl Amt-SD].AG, [Tbl Amt-SD].[CT Code] " _
& "FROM [Tbl LocFf-SD] INNER JOIN [Tbl Amt-SD] ON [Tbl LocFf-SD].FfID = [Tbl Amt-SD].FfID " _
& "WHERE ((([Tbl Amt-SD].Amt) > 0) And (([Tbl Amt-SD].GDR) = IIf([Forms]![SelectOptionsForm-SD_base].[OptMale] = " _
& "True, "M", "") Or ([Tbl Amt-SD].GDR) = IIf([Forms]![SelectOptionsForm-SD_base].[OptFemale] = True, "F", "")) And " _
& "(([Tbl Amt-SD].FA) = IIf([Forms]![SelectOptionsForm-SD_base].[Opt100] = True, 10, 0) Or ([Tbl Amt-SD].FA) = " _
& "IIf([Forms]![SelectOptionsForm-SD_base].[Opt25] = True, 5, 0) Or ([Tbl Amt-SD].FA) = " _
& "IIf([Forms]![SelectOptionsForm-SD_base].[Opt50] = True, 0, 0) Or ([Tbl Amt-SD].FA) = " _
& "IIf([Forms]![SelectOptionsForm-SD_base].[Opt100] = True, 10, 0)) And (([Tbl Amt-SD].AG) = " _
& "IIf([Forms]![SelectOptionsForm-SD_base].[Opt75] = True, "75", "")) And (([Tbl Amt-SD].[CT Code]) = "B1") And " _
& "(([Tbl LocFf-SD].Selected) = Yes))" _
& "ORDER BY [Tbl Amt-SD].Amt;"
Last edited: