Need help with forms and applyfilter command

W

webvigator2k

I have a database that I've converted from 8 seperate tables into one
cumulative table. instead of having 8 unique tables, there are 8
different tags now (machine1, machine2 etc) that ID every single
record. I've created a form, but i'm having a hard time filtering the
data out (i'm creating 8 seperate forms for each machine which all get
their data from one main table). so basically, i want the machine1
form to only show machine1 data, machine2 form to show machine2 data
etc... this is done through a hidden textbox on the form that holds
the machineID data.

this is the code i've tried to use:

DoCmd.Applyfilter, "[CumulativeSamplesDatabase].[MachineID] =
[Machine1Active]"

the idea of the code above was to only bring up records that have
"machine1active" in the MachineID field.
 
L

Larry Linson

How are you opening the Forms? If from VBA code, you can do one of two
things: Use the WhereCondition argument of DoCmd.OpenForms, or pick up an
SQL string to replace the RecordSource of the Form in the Form's Open Event.
I can't see any need at all to have separate identical Forms, unless you
want to just click them in the Forms tab of the Database window to open the
Form.

Larry Linson
Microsoft Access MVP
 
A

Arno R

8 separate forms is a bad idea... What a PITA if you need to apply changes !

There are several ways in which you can filter the records shown on the form.
'Query by Form' is easy to accomplish.
You need one combo on the 'calling form' (cboMachineID)
cboMachineID rowsource = Machine1; Machine2; Machine 3; ...
Base the form on a query where MachineID = Forms!CallingForm!cboMachineID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top