Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a query from a form

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
I've seen this dome but I don't know how to do it!

I need to open a query with a button on a form. I only want to see the items from a single source.
i.e. The query fields are: Date Item and Quantity

The item is a part number. The query includes all part numbers, and quantities for each date.

The form is set up by item Number [Item]
I tried using a micro to open up the query. In the query under Item, I put =[Item}.
When I click on the command button, the query opens and asks for [Item} and I have to inter the Item number.
How can I get the query to automatically select the current form's Item number?

This Newbie thanks you in advance for your HELP!
 
Create a form (could be datasheet) and use the where condition of DoCmd.OpenForm to filter the displayed records. The below code assumes some field/control names as well as a numeric data type.

Code:
Private Sub Item_DblClick(Cancel As Integer)
    DoCmd.OpenForm "frmYourFormName", acFormDS, , "Item = " & Me.Item
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top