G
Guest
I have copied and changed the code successfully for two other forms they have
been working fine and I am now ready to create two more similar forms (thus,
copy and change the two tables and fields again). However, this time when I
change the VB code to the new fields and tables I get no syntax errors while
in VB but when I try to use the form and press the button (which runs the on
click event procedure) to run the code I get the message "Syntax error in
group by clause" I click ok and then I get another error box "Object variable
or with block variable not set"...I click ok again and this last error pops
up again...and again...and again...until I have to do a Ctrl/Alt/Del and it
knocks me completely out of Access. I don't know how much code to include in
this forum but here is the SQL statement.
(I should probably mention that I have a drop-down combo that this code uses
to choose information to display-I click on that and choose a group first)
strSQL = "TRANSFORM First(T.[FOB]) AS [FirstOfFOB]" _
& " SELECT T.SUPSUBFL, T.[Item #], T.[Item Description], T.[Item
Size], First(T.[FOB])" _
& " AS [First Of FOB]" _
& " FROM (SELECT " & strTableItems & ".[Item #], " & strTableFOB &
".[FOB Begin Date]," _
& strTableFOB & ".[FOB End Date], " & strTableFOB & ".[FOB]," _
& strTableItems & ".SUPSUBFL," _
& strTableFOB & ".[Query Date], " & strTableItems & ".[Item
Description]" & strTableItems & ".[Item Size]" _
& " FROM " & strTableItems & " RIGHT JOIN " & strTableFOB _
& " ON " & strTableItems & ".[Item #] = " & strTableFOB & ".[ITEM
#]" _
& " ORDER BY " & strTableFOB & ".[FOB Begin Date]) AS T" _
& " WHERE T.SUPSUBFL = '" & cboGroup & "'" _
& " And T.[FOB Begin Date] Between #" & DateSerial(Me.dteYear, 1,
1) & "# And #" & DateSerial(Me.dteYear, 12, 31) & "#" _
& " GROUP BY T.SUPSUBFL, T.[Item #], T.[Item Description], T.[Item
Size], " _
& " PIVOT T.[FOB Begin Date];"
Any help would be appreciated and I thank you in advance.
Donna
been working fine and I am now ready to create two more similar forms (thus,
copy and change the two tables and fields again). However, this time when I
change the VB code to the new fields and tables I get no syntax errors while
in VB but when I try to use the form and press the button (which runs the on
click event procedure) to run the code I get the message "Syntax error in
group by clause" I click ok and then I get another error box "Object variable
or with block variable not set"...I click ok again and this last error pops
up again...and again...and again...until I have to do a Ctrl/Alt/Del and it
knocks me completely out of Access. I don't know how much code to include in
this forum but here is the SQL statement.
(I should probably mention that I have a drop-down combo that this code uses
to choose information to display-I click on that and choose a group first)
strSQL = "TRANSFORM First(T.[FOB]) AS [FirstOfFOB]" _
& " SELECT T.SUPSUBFL, T.[Item #], T.[Item Description], T.[Item
Size], First(T.[FOB])" _
& " AS [First Of FOB]" _
& " FROM (SELECT " & strTableItems & ".[Item #], " & strTableFOB &
".[FOB Begin Date]," _
& strTableFOB & ".[FOB End Date], " & strTableFOB & ".[FOB]," _
& strTableItems & ".SUPSUBFL," _
& strTableFOB & ".[Query Date], " & strTableItems & ".[Item
Description]" & strTableItems & ".[Item Size]" _
& " FROM " & strTableItems & " RIGHT JOIN " & strTableFOB _
& " ON " & strTableItems & ".[Item #] = " & strTableFOB & ".[ITEM
#]" _
& " ORDER BY " & strTableFOB & ".[FOB Begin Date]) AS T" _
& " WHERE T.SUPSUBFL = '" & cboGroup & "'" _
& " And T.[FOB Begin Date] Between #" & DateSerial(Me.dteYear, 1,
1) & "# And #" & DateSerial(Me.dteYear, 12, 31) & "#" _
& " GROUP BY T.SUPSUBFL, T.[Item #], T.[Item Description], T.[Item
Size], " _
& " PIVOT T.[FOB Begin Date];"
Any help would be appreciated and I thank you in advance.
Donna