Open form to a specific record?

W

wolfpack

Hi.

I am trying to open a form to a specific record so a user can edit
information. The form displays information regarding a person (reviewer).

So I have a combobox that allows the user to select a reviewer. The box has
three columns: ReviewerId, LastName, FirstName and is bound to the ReviewerId.

After the reviewer is selected I want the user to click an"Edit this
Reviewer" button and be taken to the Reviewer form.

I can get the form to open but it just goes to the first record instead of
the record the user chose. How can I change this?

I'm working in Access 2003.

Thanks
 
K

KARL DEWEY

Use the ReviewerId from the combo box as criteria for the query that feeds
the form.
 
G

Golfinray

Put a combo box on your form. Allow the combo box wizard to do that for you
and select the field that you want to select on. Then right click on the
combo, go to properties, go to events, and the afterupdate event. Push the
little button out to the right and start the code builder. Type:
Me.filter = "[your field] =""" & Me.combo# & """"
Me.filteron = true
The combo # will be listed, like combo10 or combo22.

wolfpack said:
Thanks for the response but i am new to this. Exactly how is that done?
 
W

wolfpack

I really need to have this done with a button instead of afterupdate on the
combobox.

What I have is a combobox (cmboEditSelection) that gives me the ReviewerID.
What I am looking for is the code to make the command button open the
frmReviewer form and go to the ReviewerID stored by cmboEditSelection.
 
J

Jack Cannon

This should do it for you.

Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = "[ReviewerID]=" & cmboEditSelection.Value
stDocName = "frmReviewer"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

Jack Cannon

wolfpack said:
I really need to have this done with a button instead of afterupdate on the
combobox.

What I have is a combobox (cmboEditSelection) that gives me the ReviewerID.
What I am looking for is the code to make the command button open the
frmReviewer form and go to the ReviewerID stored by cmboEditSelection.



Golfinray said:
Put a combo box on your form. Allow the combo box wizard to do that for you
and select the field that you want to select on. Then right click on the
combo, go to properties, go to events, and the afterupdate event. Push the
little button out to the right and start the code builder. Type:
Me.filter = "[your field] =""" & Me.combo# & """"
Me.filteron = true
The combo # will be listed, like combo10 or combo22.
 

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