Find field in selected record

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
 
D

Duane Hookom

Don't "bring it up" in a table view. Create a form where you can use code
and fire event procedures.
 
G

Ginger

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
 
V

Van T. Dinh

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
 

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