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? =)