display selection in form

S

susan

Hi,

In a form I display products. One of the fields in the records is
"supplier". Beneath this field I placed a commandbutton "details". Clicking
this button shows details of the supplier. These details are stored in a
query called "supplierinfo". I built a form "frm SuppInfo"that displays the
info of this query.
How can I display only the matching record of "supplierinfo"

Example: the value of "supplier" in the form products is "Johnson". Clicking
the commandbutton must display the record in the query where the value of
the field "suppliername" is "Johnson".



Private Sub Button124_Click()

DoCmd.OpenForm "frmSuppInfo"

End Sub



Thanks
 
D

Daniel Pineault

If you look at the help file, you'll see the basic synthax structure for the
OpenForm Method is

expression.OpenForm(FormName, View, FilterName, WhereCondition, DataMode,
WindowMode, OpenArgs)

and the example given is

DoCmd.OpenForm "Employees", , ,"LastName = 'King'"


So you, like in the example, need to add a WhereCondition when opening your
form such as.

DoCmd.OpenForm "frmSuppInfo", , ,"SupplierName = '" & Me.Supplier & "'"
 

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