Filtering data by clicking a button
I'm pretty new to Access so bear with me.
First of all I have a Table with 6 columns, namely: first name
, second name
, address
, city
, state
and zip
.
I have designed a report where only the firs开发者_Go百科t names appear with a button behind them.
If the button is pressed I want a form to open on the row so that it gives the details of the person clicked.
I have already created the form it opens up, yet I can't get to open the right record.
What must I do to get the right record?
The OpenForm method of DoCmd has the following arguments:
expression.OpenForm(FormName, View, FilterName, WhereCondition,
DataMode, WindowMode, OpenArgs)
-- http://msdn.microsoft.com/en-us/library/aa141520(v=office.10).aspx
The one you need is the WhereCondition
You do not mention a unique ID on your table, but you will need one, so add an autonumber field to your table if it does not already have one. You will also need to ensure that the form (not report) includes this field, although it does not have to be visible. Your code will then look something like:
DoCmd.OpenForm "PersonDetails",,,"ID=" & Me.ID
Thanks for your reply
I already solved the problem!
I droped the report and created a form instead(I thought that only reports were able to list the rows)
Added a macro when clicked on the ID number on the dataview form the detailed view opens with the same ID number
精彩评论