Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing update query not working

Status
Not open for further replies.

Crownknox

Technical User
Apr 27, 2000
25
0
0
US
The problem I have is this:
I like to print multiple invoices at the same time. To do this I have a yes/no field [tobeprinted] in [datatable1]. The query for the Invoice reports selects all records in the [datatable1] where the [tobeprinted]=False. So far, so good.

Next, I have a command button Print_Click on a form. When selected, the event procedure below is executed.
--------------------
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SetWarnings False
DoCmd.OpenQuery "UpdateInvoicePartPrice", acNormal, acEdit
DoCmd.OpenReport "Invoice", acpRINT, "", ""
DoCmd.OpenQuery "updatePrintYes", acNormal, acEdit
DoCmd.RunCommand acCmdSaveRecord
End
-------------------
The Query "UpdateInvoicePartPrice" updates [invoiceprices].[partprice] from [itemlist].[unitprice] AND updates [InvoiceMain].[DateInvoiced]=Date().This is done from all records where [datatable1].[tobeprinted]=true This works great when only ONE recorded is selected to be printed. But returns the partprice to $0.00 if more that one record is selected.

Next it prints

And Finally it updates all records [tobeprinted]=No.

Why does the update not work right when more that one records [tobeprinted]=TRUE????????

This is a big problem for me.

Can anyone Help??????????
 
Could you post the sql statements for the 2 querys then we can perhaps give better advice.
 
Here are the two queries
----------------------------
Query: UpdateInvoicePartPrice

UPDATE ShipperMain INNER JOIN InvoicePrices ON ShipperMain.ShipperNumber = InvoicePrices.ShipperNumber SET InvoicePrices.PartPrice = [unitprice], ShipperMain.Invoiced = Date()
WHERE (((ShipperMain.Print)=Yes));


Query: UpdatePrintYes

UPDATE ShipperMain SET ShipperMain.Print = No;
------------------------
Again, this works great when only one records (ShipperMain.Print)=Yes, but when more than one is yes it updates the unitprice to $0.00 instead of the correct price.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top