Find field in selected record

  • Thread starter Thread starter Ginger
  • Start date Start date
G

Ginger

I have a database (access 2000) and when i bring up the
product table in a view mode, and I select a record that
has an id field as an autonumber, how do I put the
autonumber into a variable, so I can use it on another
form, and have it go to the same record to edit it?

Thank you in advance.

Ginger
 
Don't "bring it up" in a table view. Create a form where you can use code
and fire event procedures.
 
I'm sorry, I should have been more clear. What I originally
bring up is a form for viewing the product table, in a grid
format.
So, what you are saying is that it is possible, this way,
to use the event procedures to see that a record is
selected, then grab the ID autonumber for that record,
assign it's value to a variable that I can use to find the
same record on the edit form? Yes?

Ginger
 
You don't even have to assign it to a variable. Just use the reference to
the Control in the first Form directly.

For example, if you have the Control txtID on the first Form and a
CommandButton to open the second Form, you can use the "wherecondition"
argument of the OpenForm method in the CommandButton_Click event like:

DoCmd.OpenForm "SecondForm", , , _
"[ID] = " & Me.txtID
 
Back
Top