Order Button from Customer form

S

Simon

I have a Customer form with a a button at the bottom to place an order,
How do i set the oder button to open the oder form and place the
CustomersID numberautomaticla in the order forms customer ID box

Thanks

Simon
 
A

Allen Browne

This event procedure in the Click event procedure of your command button
should give you the idea:

Private Sub cmdOrder_Click()
If Me.Dirty Then 'Save first.
Me.Dirty= false
End If
If Me.NewRecord Then 'Check there is a customer.
MsgBox "Enter the client before ordering."
Else
DoCmd.OpenForm "frmOrder"
With Forms("frmOrder")
.SetFocus 'In case it was already open.
If Not .NewRecord Then
RunCommand acCmdRecordsGotoNew
End If
!CustomerID = Me.CustomerID
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top