3061 Error

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I am receiving a 3061 error, that emanates from the below statement. If I
remove
"([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND" it works OK. What am i
doing wrong?

thanx

strSQL = "INSERT INTO Labels ( LabType, LabPOSOSNumber, LabLine1, LabLine2,
LabLine3, LabLine4, LabLine5) " & _
"SELECT 'S' AS Expr1, PurchaseOrd.PurchaseOrderNo, [SUPPLIER
SCHEDULE].[COMPANY NAME], [SUPPLIER SCHEDULE].[BUSINESS ADDRESS], [SUPPLIER
SCHEDULE].SUBURB, [STATE] & ' ' & [POST CODE/ZIP CODE] AS Expr2, [SUPPLIER
SCHEDULE].COUNTRY " & _
"FROM [SUPPLIER SCHEDULE] INNER JOIN PurchaseOrd ON [SUPPLIER
SCHEDULE].[SUPPLIER ID] = PurchaseOrd.SupplierId " & _
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND
(PurchaseOrd.PurchaseOrderNo = '" & strPurchaseOrderNo & "');"
 
Max,

First thing to check (which I know you will have done so already but
you need to look again) is the spelling, in particular is there a
field called exactly MAILING LIST in the SUPPLIER SCHEDULE
table/query? If it is correctly spelled in the SQL, is MAILING LIST a
Yes/No data type, or is it a text field? If it's a text field, you
would need...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = 'Yes') AND
If it's a Yes/No field, I think it should work with Yes as the
criteria, but just for a laugh, try...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = -1) AND

- Steve Schapel, Microsoft Access MVP
 
thanx Steve,
yep, i checked both. Spelling is correct and it is a Yes/No field. I
tried -1 but no difference.
Um, does the field MAILING LABEL have to be in the SELECT statement for
this to work?

Max

Steve Schapel said:
Max,

First thing to check (which I know you will have done so already but
you need to look again) is the spelling, in particular is there a
field called exactly MAILING LIST in the SUPPLIER SCHEDULE
table/query? If it is correctly spelled in the SQL, is MAILING LIST a
Yes/No data type, or is it a text field? If it's a text field, you
would need...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = 'Yes') AND
If it's a Yes/No field, I think it should work with Yes as the
criteria, but just for a laugh, try...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = -1) AND

- Steve Schapel, Microsoft Access MVP


I am receiving a 3061 error, that emanates from the below statement. If I
remove
"([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND" it works OK. What am i
doing wrong?

thanx

strSQL = "INSERT INTO Labels ( LabType, LabPOSOSNumber, LabLine1, LabLine2,
LabLine3, LabLine4, LabLine5) " & _
"SELECT 'S' AS Expr1, PurchaseOrd.PurchaseOrderNo, [SUPPLIER
SCHEDULE].[COMPANY NAME], [SUPPLIER SCHEDULE].[BUSINESS ADDRESS], [SUPPLIER
SCHEDULE].SUBURB, [STATE] & ' ' & [POST CODE/ZIP CODE] AS Expr2, [SUPPLIER
SCHEDULE].COUNTRY " & _
"FROM [SUPPLIER SCHEDULE] INNER JOIN PurchaseOrd ON [SUPPLIER
SCHEDULE].[SUPPLIER ID] = PurchaseOrd.SupplierId " & _
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND
(PurchaseOrd.PurchaseOrderNo = '" & strPurchaseOrderNo & "');"
 
thanx Steve,

spelling is correct and the field is aYes/No field. Tried -1 but no joy.
Um... is the problem the fact that MAILING LIST is not in the SELECT
statement?

Max
Steve Schapel said:
Max,

First thing to check (which I know you will have done so already but
you need to look again) is the spelling, in particular is there a
field called exactly MAILING LIST in the SUPPLIER SCHEDULE
table/query? If it is correctly spelled in the SQL, is MAILING LIST a
Yes/No data type, or is it a text field? If it's a text field, you
would need...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = 'Yes') AND
If it's a Yes/No field, I think it should work with Yes as the
criteria, but just for a laugh, try...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = -1) AND

- Steve Schapel, Microsoft Access MVP


I am receiving a 3061 error, that emanates from the below statement. If I
remove
"([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND" it works OK. What am i
doing wrong?

thanx

strSQL = "INSERT INTO Labels ( LabType, LabPOSOSNumber, LabLine1, LabLine2,
LabLine3, LabLine4, LabLine5) " & _
"SELECT 'S' AS Expr1, PurchaseOrd.PurchaseOrderNo, [SUPPLIER
SCHEDULE].[COMPANY NAME], [SUPPLIER SCHEDULE].[BUSINESS ADDRESS], [SUPPLIER
SCHEDULE].SUBURB, [STATE] & ' ' & [POST CODE/ZIP CODE] AS Expr2, [SUPPLIER
SCHEDULE].COUNTRY " & _
"FROM [SUPPLIER SCHEDULE] INNER JOIN PurchaseOrd ON [SUPPLIER
SCHEDULE].[SUPPLIER ID] = PurchaseOrd.SupplierId " & _
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND
(PurchaseOrd.PurchaseOrderNo = '" & strPurchaseOrderNo & "');"
 
oops, yes i should have been a little more meticulous in checking :o) the
field is MAILING LABEL

thanx and happy new year

Max
Steve Schapel said:
Max,

First thing to check (which I know you will have done so already but
you need to look again) is the spelling, in particular is there a
field called exactly MAILING LIST in the SUPPLIER SCHEDULE
table/query? If it is correctly spelled in the SQL, is MAILING LIST a
Yes/No data type, or is it a text field? If it's a text field, you
would need...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = 'Yes') AND
If it's a Yes/No field, I think it should work with Yes as the
criteria, but just for a laugh, try...
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = -1) AND

- Steve Schapel, Microsoft Access MVP


I am receiving a 3061 error, that emanates from the below statement. If I
remove
"([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND" it works OK. What am i
doing wrong?

thanx

strSQL = "INSERT INTO Labels ( LabType, LabPOSOSNumber, LabLine1, LabLine2,
LabLine3, LabLine4, LabLine5) " & _
"SELECT 'S' AS Expr1, PurchaseOrd.PurchaseOrderNo, [SUPPLIER
SCHEDULE].[COMPANY NAME], [SUPPLIER SCHEDULE].[BUSINESS ADDRESS], [SUPPLIER
SCHEDULE].SUBURB, [STATE] & ' ' & [POST CODE/ZIP CODE] AS Expr2, [SUPPLIER
SCHEDULE].COUNTRY " & _
"FROM [SUPPLIER SCHEDULE] INNER JOIN PurchaseOrd ON [SUPPLIER
SCHEDULE].[SUPPLIER ID] = PurchaseOrd.SupplierId " & _
"WHERE ([SUPPLIER SCHEDULE].[MAILING LIST] = Yes) AND
(PurchaseOrd.PurchaseOrderNo = '" & strPurchaseOrderNo & "');"
 
Back
Top