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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR 3061

Status
Not open for further replies.

mikeba1

Programmer
Jan 2, 2005
235
GB
I get the error 3061 when I run the following
CurrentDb.Execute "qryremovepurchaseinvoicesplplinks"

However when I run it as
DoCmd.OpenQuery "qryremovepurchaseinvoicesplplinks"

I get no errors.

The query is as follows
UPDATE PurchaseInvoices SET PurchaseInvoices.PLIPmtShedNo = Null, PurchaseInvoices.PLIPmtSchedDate = Null
WHERE (((PurchaseInvoices.PLIPmtShedNo)=[Forms]![frmPaymentSchedule]![PLPNo]));

Any ideas??
 
What happens if you try:

Code:
Dim strSQL As String
[COLOR=#4E9A06]' assuming the code is running in frmPaymentSchedule and PLIPmtShedNo is numeric[/color]
strSQL = "UPDATE PurchaseInvoices SET PLIPmtShedNo = Null, PLIPmtSchedDate = Null " & _
    "WHERE PLIPmtShedNo= " & Me![PLPNo]
CurrentDb.Execute strSQL, dbFailOnError
or
Code:
Dim strSQL As String
[COLOR=#4E9A06]' assuming the code is running in frmPaymentSchedule and PLIPmtShedNo is Text[/color]
strSQL = "UPDATE PurchaseInvoices SET PLIPmtShedNo = Null, PLIPmtSchedDate = Null " & _
    "WHERE PLIPmtShedNo= """ & Me![PLPNo] & """"
CurrentDb.Execute strSQL, dbFailOnError

Duane
Hook'D on Access
MS Access MVP
 
Thanks,the first bit of code worked.
But why ?

The code looks like the query ?
 
The query executed by the code I suggested didn't include a reference to a form and control name. It did include the actual value from that control. It also used dbFailOnError.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top