Open a form and pass a parameter

  • Follow


I have a main form displayere list of employees.
I would like to open a second form to display the details of a selected 
employee. How can I do that?

One way I am thinking of is pass the employee number as argument when open 
the second form.


0
Reply Alan 5/25/2007 3:41:25 AM

On Fri, 25 May 2007 13:41:25 +1000, Alan T wrote:

> I have a main form displayere list of employees.
> I would like to open a second form to display the details of a selected 
> employee. How can I do that?
> 
> One way I am thinking of is pass the employee number as argument when open 
> the second form.

You don't need to pass the second form the employee number.
All you need do is open the second form (from the already open first
form) using the where argument of the DoCmd.OpenForm method.

Assuming the [EmployeeID] datatype is Number:
DoCmd.OpenForm "Form2", , , "[EmplyeeID] = " & Me![EmployeeID]

Form2 will open showing the records of the employee selected on Form1.

Look up the OpenForm method in VBA help.
-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
Reply fredg 5/25/2007 4:28:49 AM


1 Replies
1517 Views

(page loaded in 0.181 seconds)


Reply: