Command button update field in form?

Garindan

Registered User.
Local time
Today, 06:59
Joined
May 25, 2004
Messages
250
Hi all, I have a form with a command button to open a report. The user clicks a toggle on the form to select which records to show in the report - 'Delivered' Yes/No.

The subform displays orders which have not been processed using 'Processed' Yes/No, with No in the query criteria.

So what I would like to do is have the user select which orders to send to the report, and when the command button is clicked, update the 'Processed' field for those records to 'Yes, True, -1 etc' and requery the subform to remove those records. They have then been 'Processed'.

Could someone give me a little help with how to do this?

I would also like to add a warning dialog to the button like 'This will send selected orders for delivery and remove them from this form,are you sure you wish to continue?' Ok/Cancel. But I'm not sure how to do this either.

Here's all I have so far:-
Code:
Private Sub btnOpenDelivRpt_Click()

  'Send selected records to delivery report.

  If Me!txtSelected = 0 Then

    MsgBox "Please select an Order to print", vbOKOnly, "Error"

  Else

    DoCmd.OpenReport "rptOrderDeliveries", acViewPreview

  End If

  Exit Sub

End Sub

Many thanks for any help! :)
 
Send a short example of your MDB, (access 2000 or 2002-2003).
 
Hi, that might take a while, I have 45000 records, 20 odd queries and forms etc to remove :/

I have found this to be something like I want:-
Code:
CurrentDb.Execute "UPDATE Orders SET Orders.SelectedPrint = Yes;"
Me.Requery

Mine would be "UPDATE tblCustomerOrders SET tblCustomerOrders.Processed = Yes;" but how could I change it to update that field for the selected records in the subform and not the whole database???
 

Users who are viewing this thread

Back
Top Bottom