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 & "'"
 
Top