Linking to record in form view

T

TES

I would like to have a link in one of the columns in my table view that will
take the user to that record displayed in a form view. Is this possible to
do in an existing base?

Thanks.
 
S

Steve

You can create a search on your form that will display a selected record.

Steve
(e-mail address removed)
 
G

Gina Whipp

TES,

Not from table view but it can be done using a form. You can create a form
to look like your table and place a hyperlink on it to open another form,
with something like...

DoCmd.OpenForm "YourFormName"

Tables are meant to just hold the data not interact with it.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

I would like to have a link in one of the columns in my table view that will
take the user to that record displayed in a form view. Is this possible to
do in an existing base?

Thanks.
 
T

TedMi

As Gina says, create a form to query your table and display it in datasheet
or continuous form view. On one of the text boxes of the form (e.g.
LastName), establish a double-click event that executes this code:
DoCmd.OpenForm FormName:="YourFormName", View:=acNormal, OpenArgs:=txtID

Where txtID is the tex box on your datasheet view that contains the unique
identifier of the row on which you clicked.

In the Load event of YourFormaName, insert this code:
If Len(Nz(OpenArgs, "") > 0 Then
Me.RecordSet.Clone.FindFirst "[ID]=" & OpenArgs
Me.Bookmark = Me.RecordSet.Clone.Bookmark
End If

Where [ID] is the name of field in the TABLE which is the datasource for the
form.
An alternative method:
DoCmd.OpenForm FormName:="YourFormName", View:=acNormal,
WhereCondition:="[ID]=" & txtID

Then you don't need anything in the Load event of the form.
Differences: With the first method, the user can navigate over the
datasource of the form. In the second, the form is limited to displaying the
one record identified by the value of ID.
 
T

TedMi

As Gina says, you need to create a form whose data source is the table in
question. Display the form in datasheet or continuous view. On one of the
fields of the form, establish a double-click event that executes this code:
DoCmd.OpenForm FormName:="YourFormName", View=acNormal,
WhereCondition:="[ID]= & txtID

Where YourFormName is designed to display a single record from your table
(presumably with more detail than displayed in the datasheet view), txtID is
the name of the control holding the unique identifier of the row on which
you clicked, and [ID] is the name of the field in the underlying table that
holds this identifier.

This method will limit the single-record form to the one record identified
by ID. If you would to allow the user to navigate to other records in
single-record view, use this instead:
DoCmd.OpenForm FormName:="YourFormName", View=acNormal, OpenArgs:=txtID

Then in the Load event of YourFormName, execute this code:

If Len(Nz(OpenArgs, "")) > 0 Then
Me.Recordset.Clone.FindFirst "[ID]=" & OpenArgs
Me.Recordset.Bookmark = Me.Recordset.Clone.Bookmark
End If
Good luck!

-TedMi
 

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