[AccessD] One form for all

Stuart McLachlan stuart at lexacorp.com.pg
Mon Mar 17 07:10:00 CST 2003


> 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.






More information about the AccessD mailing list