Hollis,Virginia
HollisVJ at pgdp.usec.com
Mon Mar 17 07:46:00 CST 2003
What do I do if it is a new record they are adding to Form 3? When a new record is added using Form 3, the RequestID (FK) shows 0. I need it to enter the same RequestID as the opening form, whether it is Form 1 or Form 2. Form 3 needs to open and set the FK - (RequestID in Table 2) to the same RequestID (PK in Table 1) as in Form 1 or Form 2. Virginia -----Original Message----- From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg] Sent: Monday, March 17, 2003 7:10 AM To: Hollis,Virginia; accessd at databaseadvisors.com Subject: Re: [AccessD] One form for all > Form 1: A form that is used for requesting services - a data entry form. > Form 2: Used by the engineer to edit, update data from the request. > Form 3: Additional data form needed to open for the User & Engineer > > The table has a RequestID as the PK > A second table is used to store additional data, with the RequestID as FK. > > I need Form 3 to open from either Form 1 or Form 2. How do I set the > RequestID FK to the PK RequestID on Form 3? I placed the FK on Form 3 and > set the default to =Forms!Form1.RequestID. Of course this will not work on > Form 2 because the default value for RequestID references Form 1. > > I do not want to create multiple forms to do the same thing - but if that is > the only choice I will. How can I have Form 3 open from Form 1 &/or Form 2 > and set the RequestID? > Set Form3 recordsource to the Table2 and filter the form 1. In the Sub in Form1 and Form2 that opens Form3: DoCmd.OpenForm "Form3", , , "RequestID = " & request_ID Or: Use OpenArgs: In Form1 and 2 DoCmd.OpenForm "Form3", , , , , , Request_ID In Form3 Private Sub Form_Open(Cancel As Integer) Me.Filter = "RequestID = " & OpenArgs Me.FilterOn = True End Sub -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.