Simple Filter or Query Solution Request (1 Viewer)

boomslanger

Registered User.
Local time
Today, 16:35
Joined
Jun 18, 2009
Messages
16
This is a very simple request but I have not been able to find a way to do it. I'm coming back to Access after not having touched it since 97.

We sell and maintain several types of high end electronic systems. I have created a main form for all our company assets under management and several supporting objects which is all working well. What I need to do is bring up a filtered assets datasheet form filtered on the value in a field.

For example:

If the current value in the Asset field is Baringa and then the user clicks on the List Assets control the resulting datasheet form should only list the Baringa assets. If the user then moves to another record and the asset is now Hydra then clicks on the List Assets control only Hydra records should show up in the datasheet form.

The other options selectable by the user are List by Category, List by Configuration, List by Project, List by OEM and List by Customer.

In each case whatever the value in the corresponding field, Category, Configuration, Project, OEM or Customer should be the criteria for what comes up in the datasheet. I don't need multiple or complicated criteria, just the datasheet form filtered on what's currently in the field corresponding to control.

The queries I've attempted haven't worked and then I thought that this would be more easily achieved by Filter, but don't know how to go about it. Any help would be appreciated.
 

CameronM

Registered User.
Local time
Today, 15:35
Joined
Jan 9, 2009
Messages
147
When you open the datasheet form, use the WHERE clause to filter the results.

For example, if the user has the form open where the Asset field is called txtAsset and they press the button labelled List Assets, called cmdListAssets the following code would open the datasheet form called frmProductsList

Code:
Private Sub cmdListAssets_Click()
    DoCmd.OpenForm "frmProductsList", acFormDS, , "AssetName='" & Me.txtAsset & "'"
End Sub

You may need to tweak this a little if your Asset field is a combobox, but this may point you in the right direction.
 

boomslanger

Registered User.
Local time
Today, 16:35
Joined
Jun 18, 2009
Messages
16
Thanks heaps, I think that is what I want. I looked at the Where clause but was uncertain as to how to implement it.

Category, which is one of the user selections, is a combobox but I think I have enough to work it out now.

Regards.
 

Users who are viewing this thread

Top Bottom