PC Review


Reply
Thread Tools Rate Thread

Can't Isolate Syntax Error

 
 
=?Utf-8?B?U2hhcmtieXRl?=
Guest
Posts: n/a
 
      27th Feb 2006
I've been trying to isolate a syntax error, and am having no luck. Hoping
some fresh eyes could help me out.

Thanks in advance.


Here is the SQL statement:

insert into tblscsalesorderdetails (ordernumber, itemid, locationid,
qtyordered, qtyshipped, listprice, discount, extended, stagedpart) values
([forms]![frmscsalesinvoice]![txtordernumber],
[forms]![frmviewstagedparts]![itemid],
[forms]![frmviewstagedparts]![truckid],
[forms]![frmviewstagedparts]![quantity],
[forms]![frmviewstagedparts]![quantity], '" & gblListPrice & "', '" &
gblDiscount & "', ([forms]![frmviewstagedparts]![quantity] * ('" &
gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;

I have also tried it as a String statement, as suggested in a previous post:

gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid,
locationid, qtyordered, qtyshipped, listprice, discount, extended,
stagedpart) values ('" & [Forms]![frmscsalesinvoice]![txtOrderNumber] & "',
'" & [Forms]![frmviewstagedparts]![ItemID] & "', '" &
[Forms]![frmviewstagedparts]![TruckID] & "', '" &
[Forms]![frmviewstagedparts]![Quantity] & "', '" &
[Forms]![frmviewstagedparts]![Quantity] & "', '" & gblListPrice & "', '" &
gblDiscount & "', ('" & [Forms]![frmviewstagedparts]![Quantity] & "' * ('" &
gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;"


So....any brilliant suggestions? =)
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?=
Guest
Posts: n/a
 
      27th Feb 2006
Hi Sharkbyte,

> So....any brilliant suggestions? =)


Why, of course! Add a Debug.Print gblStrSQL
statement. Then examine the results in the Immediate window (Ctrl G). Is
your statement picking up the correct values referenced in the two forms?
Are these values from the forms text or numeric? If text, you must wrap them
in quotes. I prefer to use Chr(34) myself.

The value that you showed as gblStrSQL is not correct, unless it is all on
one long line. If it is on several lines, then you need to add the line
continuation character, which is a space plus an underscore. You'll also need
to terminate each line in double quotes. For example:

gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid, " _
& "locationid, qtyordered, qtyshipped, listprice, discount, extended, " _

etc.

If your form references appear to be inserted correctly, then copy the
resulting SQL statement from the Immediate window and paste it into the SQL
window of a new query. When you attempt to run the query, you will likely get
an error that provides a meaningful clue.


Tom

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


"Sharkbyte" wrote:

> I've been trying to isolate a syntax error, and am having no luck. Hoping
> some fresh eyes could help me out.
>
> Thanks in advance.
>
>
> Here is the SQL statement:
>
> insert into tblscsalesorderdetails (ordernumber, itemid, locationid,
> qtyordered, qtyshipped, listprice, discount, extended, stagedpart) values
> ([forms]![frmscsalesinvoice]![txtordernumber],
> [forms]![frmviewstagedparts]![itemid],
> [forms]![frmviewstagedparts]![truckid],
> [forms]![frmviewstagedparts]![quantity],
> [forms]![frmviewstagedparts]![quantity], '" & gblListPrice & "', '" &
> gblDiscount & "', ([forms]![frmviewstagedparts]![quantity] * ('" &
> gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;
>
> I have also tried it as a String statement, as suggested in a previous post:
>
> gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid,
> locationid, qtyordered, qtyshipped, listprice, discount, extended,
> stagedpart) values ('" & [Forms]![frmscsalesinvoice]![txtOrderNumber] & "',
> '" & [Forms]![frmviewstagedparts]![ItemID] & "', '" &
> [Forms]![frmviewstagedparts]![TruckID] & "', '" &
> [Forms]![frmviewstagedparts]![Quantity] & "', '" &
> [Forms]![frmviewstagedparts]![Quantity] & "', '" & gblListPrice & "', '" &
> gblDiscount & "', ('" & [Forms]![frmviewstagedparts]![Quantity] & "' * ('" &
> gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;"
>
>
> So....any brilliant suggestions? =)

 
Reply With Quote
 
=?Utf-8?B?U2hhcmtieXRl?=
Guest
Posts: n/a
 
      27th Feb 2006
Thanks for the suggestion(s), Tom. And while it didn't actually solve my
problem ( I happened upon it just through sheer determination...), it did
show me another way to troubleshoot, and actually pointed me to another
problem that would have surfaced once my first was resolved. (Did you follow
all that?)

The problem was so amazingly simple....

If you look at the SQL statement - both iterations - you'll see that I
forgot the closing ')' for the VALUES statement. DUH!

So, with that, I must say that I am done fighting with this, for the night.

Thanks, again.

Sharkbyte




"Tom Wickerath" wrote:

> Hi Sharkbyte,
>
> > So....any brilliant suggestions? =)

>
> Why, of course! Add a Debug.Print gblStrSQL
> statement. Then examine the results in the Immediate window (Ctrl G). Is
> your statement picking up the correct values referenced in the two forms?
> Are these values from the forms text or numeric? If text, you must wrap them
> in quotes. I prefer to use Chr(34) myself.
>
> The value that you showed as gblStrSQL is not correct, unless it is all on
> one long line. If it is on several lines, then you need to add the line
> continuation character, which is a space plus an underscore. You'll also need
> to terminate each line in double quotes. For example:
>
> gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid, " _
> & "locationid, qtyordered, qtyshipped, listprice, discount, extended, " _
>
> etc.
>
> If your form references appear to be inserted correctly, then copy the
> resulting SQL statement from the Immediate window and paste it into the SQL
> window of a new query. When you attempt to run the query, you will likely get
> an error that provides a meaningful clue.
>
>
> Tom
>
> http://www.access.qbuilt.com/html/ex...tributors.html
> http://www.access.qbuilt.com/html/search.html
> __________________________________________
>
>
> "Sharkbyte" wrote:
>
> > I've been trying to isolate a syntax error, and am having no luck. Hoping
> > some fresh eyes could help me out.
> >
> > Thanks in advance.
> >
> >
> > Here is the SQL statement:
> >
> > insert into tblscsalesorderdetails (ordernumber, itemid, locationid,
> > qtyordered, qtyshipped, listprice, discount, extended, stagedpart) values
> > ([forms]![frmscsalesinvoice]![txtordernumber],
> > [forms]![frmviewstagedparts]![itemid],
> > [forms]![frmviewstagedparts]![truckid],
> > [forms]![frmviewstagedparts]![quantity],
> > [forms]![frmviewstagedparts]![quantity], '" & gblListPrice & "', '" &
> > gblDiscount & "', ([forms]![frmviewstagedparts]![quantity] * ('" &
> > gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;
> >
> > I have also tried it as a String statement, as suggested in a previous post:
> >
> > gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid,
> > locationid, qtyordered, qtyshipped, listprice, discount, extended,
> > stagedpart) values ('" & [Forms]![frmscsalesinvoice]![txtOrderNumber] & "',
> > '" & [Forms]![frmviewstagedparts]![ItemID] & "', '" &
> > [Forms]![frmviewstagedparts]![TruckID] & "', '" &
> > [Forms]![frmviewstagedparts]![Quantity] & "', '" &
> > [Forms]![frmviewstagedparts]![Quantity] & "', '" & gblListPrice & "', '" &
> > gblDiscount & "', ('" & [Forms]![frmviewstagedparts]![Quantity] & "' * ('" &
> > gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;"
> >
> >
> > So....any brilliant suggestions? =)

 
Reply With Quote
 
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?=
Guest
Posts: n/a
 
      27th Feb 2006
Hi Sharkbyte,

Glad to hear that you got it solved!

I find using Debug.Print strSQL (or gblStrSQL in your case) to be a very
useful troubleshooting technique.


Tom

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


"Sharkbyte" wrote:

> Thanks for the suggestion(s), Tom. And while it didn't actually solve my
> problem ( I happened upon it just through sheer determination...), it did
> show me another way to troubleshoot, and actually pointed me to another
> problem that would have surfaced once my first was resolved. (Did you follow
> all that?)
>
> The problem was so amazingly simple....
>
> If you look at the SQL statement - both iterations - you'll see that I
> forgot the closing ')' for the VALUES statement. DUH!
>
> So, with that, I must say that I am done fighting with this, for the night.
>
> Thanks, again.
>
> Sharkbyte
>
>
>
>
> "Tom Wickerath" wrote:
>
> > Hi Sharkbyte,
> >
> > > So....any brilliant suggestions? =)

> >
> > Why, of course! Add a Debug.Print gblStrSQL
> > statement. Then examine the results in the Immediate window (Ctrl G). Is
> > your statement picking up the correct values referenced in the two forms?
> > Are these values from the forms text or numeric? If text, you must wrap them
> > in quotes. I prefer to use Chr(34) myself.
> >
> > The value that you showed as gblStrSQL is not correct, unless it is all on
> > one long line. If it is on several lines, then you need to add the line
> > continuation character, which is a space plus an underscore. You'll also need
> > to terminate each line in double quotes. For example:
> >
> > gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid, " _
> > & "locationid, qtyordered, qtyshipped, listprice, discount, extended, " _
> >
> > etc.
> >
> > If your form references appear to be inserted correctly, then copy the
> > resulting SQL statement from the Immediate window and paste it into the SQL
> > window of a new query. When you attempt to run the query, you will likely get
> > an error that provides a meaningful clue.
> >
> >
> > Tom
> >
> > http://www.access.qbuilt.com/html/ex...tributors.html
> > http://www.access.qbuilt.com/html/search.html
> > __________________________________________
> >
> >
> > "Sharkbyte" wrote:
> >
> > > I've been trying to isolate a syntax error, and am having no luck. Hoping
> > > some fresh eyes could help me out.
> > >
> > > Thanks in advance.
> > >
> > >
> > > Here is the SQL statement:
> > >
> > > insert into tblscsalesorderdetails (ordernumber, itemid, locationid,
> > > qtyordered, qtyshipped, listprice, discount, extended, stagedpart) values
> > > ([forms]![frmscsalesinvoice]![txtordernumber],
> > > [forms]![frmviewstagedparts]![itemid],
> > > [forms]![frmviewstagedparts]![truckid],
> > > [forms]![frmviewstagedparts]![quantity],
> > > [forms]![frmviewstagedparts]![quantity], '" & gblListPrice & "', '" &
> > > gblDiscount & "', ([forms]![frmviewstagedparts]![quantity] * ('" &
> > > gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;
> > >
> > > I have also tried it as a String statement, as suggested in a previous post:
> > >
> > > gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid,
> > > locationid, qtyordered, qtyshipped, listprice, discount, extended,
> > > stagedpart) values ('" & [Forms]![frmscsalesinvoice]![txtOrderNumber] & "',
> > > '" & [Forms]![frmviewstagedparts]![ItemID] & "', '" &
> > > [Forms]![frmviewstagedparts]![TruckID] & "', '" &
> > > [Forms]![frmviewstagedparts]![Quantity] & "', '" &
> > > [Forms]![frmviewstagedparts]![Quantity] & "', '" & gblListPrice & "', '" &
> > > gblDiscount & "', ('" & [Forms]![frmviewstagedparts]![Quantity] & "' * ('" &
> > > gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;"
> > >
> > >
> > > So....any brilliant suggestions? =)

 
Reply With Quote
 
david epsom dot com dot au
Guest
Posts: n/a
 
      27th Feb 2006
> So....any brilliant suggestions? =)

.... not that it was relevant, but yes. Never use a global
variable (gblStrSQL) when a local variable will do.

Use global variables when global scope is required,
not just to save typing. Use local variables when
only local scope is required.

(david)


"Sharkbyte" <(E-Mail Removed)-> wrote in message
news:CDAB9138-00AF-42CF-9EAD-(E-Mail Removed)...
> I've been trying to isolate a syntax error, and am having no luck. Hoping
> some fresh eyes could help me out.
>
> Thanks in advance.
>
>
> Here is the SQL statement:
>
> insert into tblscsalesorderdetails (ordernumber, itemid, locationid,
> qtyordered, qtyshipped, listprice, discount, extended, stagedpart) values
> ([forms]![frmscsalesinvoice]![txtordernumber],
> [forms]![frmviewstagedparts]![itemid],
> [forms]![frmviewstagedparts]![truckid],
> [forms]![frmviewstagedparts]![quantity],
> [forms]![frmviewstagedparts]![quantity], '" & gblListPrice & "', '" &
> gblDiscount & "', ([forms]![frmviewstagedparts]![quantity] * ('" &
> gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;
>
> I have also tried it as a String statement, as suggested in a previous
> post:
>
> gblStrSQL = "insert into tblscsalesorderdetails (ordernumber, itemid,
> locationid, qtyordered, qtyshipped, listprice, discount, extended,
> stagedpart) values ('" & [Forms]![frmscsalesinvoice]![txtOrderNumber] &
> "',
> '" & [Forms]![frmviewstagedparts]![ItemID] & "', '" &
> [Forms]![frmviewstagedparts]![TruckID] & "', '" &
> [Forms]![frmviewstagedparts]![Quantity] & "', '" &
> [Forms]![frmviewstagedparts]![Quantity] & "', '" & gblListPrice & "', '" &
> gblDiscount & "', ('" & [Forms]![frmviewstagedparts]![Quantity] & "' * ('"
> &
> gblListPrice & "' * (1 - '" & gblDiscount & "'))), -1;"
>
>
> So....any brilliant suggestions? =)



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
page error that I cannot isolate =?Utf-8?B?am9uZWZlcg==?= Microsoft ASP .NET 3 7th Feb 2007 11:29 PM
Error message: Syntax error(missing operator)in query expression =?Utf-8?B?TGVzbGll?= Microsoft Access Form Coding 2 28th Oct 2005 09:39 PM
Syntax Error - Code: 800AO3EA - Souce: Microsoft VBScript compliation Error Kreacher Microsoft Windows 2000 1 23rd May 2004 12:23 PM
A runtime error has occured. Do you want to debug? Line: 1 Error: syntax error Eric Windows XP Networking 0 24th Nov 2003 03:45 PM
A Runtime error has occured. Do you wish to Debug? Line:1 Error: Syntax error Darryl Microsoft Windows 2000 Applications 0 1st Oct 2003 10:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:12 PM.