open a order form with customer id passed to orderform

  • Thread starter Thread starter AKA Sparkticus
  • Start date Start date
A

AKA Sparkticus

I know I can open a form relevant to the record on another form..
but I want to be able to open the order form in new add order state
but with the customer details taken from the open customer form..

I thought this would work but it wont :(

Add_order_Click
Forms ! [Invoice]![Contractor_F__Key] =Forms ![Contractors]![ContractorsID]
Me.Contractor_F__Key.SetFocus

im using access 2000

any help would be appreciated
 
This may be a lot more work than it should contain, but it works well for me. If this doesn't work, it should at least get your head churning about a way to do it.

1. Create a button on your Contractors form that says Create Invoice, or whatever you want.
2. Create a query with all the data needed for your Invoice form. Also, add a ContractorID field, even if you don't need it, because you will need it. Call it qryInvoices, or whatever you'd like to call it
3. In the ContractorID field of the query put in: =[Forms]![Contractors].[ContractorsID
4. Right-click on the grey area above where the tables are and go to Parameters...
5. Type in [Forms]![Contractors].[ContractorsID], and make the field type a Long Integer. These two steps create a parameter query based on the Contractors form you would presumably already have open.
6. In your Invoice form, make the record source qryInvoices (or whatever you called it). To do this right-click on the little box in the top left corner of the form in design view, and select Properties... Record Source should be the first one there under the All tab.
7. Now, in that button you created on your Contractors form, create an OnClick Event Procedure (scroll all the way down in the properties until you see it, select [Event Procedure] and click on the ... ). In the event procedure, open up the Invoices form
DoCmd.OpenForm "Invoices

That should do it.
 
Back
Top