Use 1 Form instead of 2 for criteria?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I have a customers form where I show the active and archived records
By default it shows the active customers. I have a option group on the form
to set the status of either
active or archived and also use a query to set the default of active or
archived
and right now have 2 copies of the customers form and 2 queries.
Can this be done using just the one form?

I have a custom menu with a dropdown list of active and archived customers

Thanks,

Dave
 
Just make your custom menu run some code.

So, for the menu option that shows the active records, you can put the
following in the on-action of the menu item:

=ShowActive()

then, in the form, you create a pubic function called

Public Function ShowActive

me.recordSource = "select * from tblCustomers where Active = true order
by companyName"

end function

Public Function ShowArchived

me.recordSource = "select * from tblCustomers where "whatever condtion
you need"

end function

So, your custom menu code can run the above code in the form. Note that the
code must be declared as public for the menu to find this code. And, do NOT
include a forms qualilafer in the menus on-action..as that causes the code
to run 3 times....
 
Back
Top