Open record from datasheet view

W

WordFool

Could anyone tell me how to do this? (I have seen this before)

What I want to do is list a number of records in a datasheet view and then
be able to click on one of them then a form will open allowing me to
edit/update the record I clicked on.

Any help will be appreciated.
 
N

Nick Coe \(UK\)

I'd create a continuous form to mimic the datasheet view and
then create a Single Form to view the detail. In the
OnClick or OnDoubleClick event for each column (control) of
the continuous form open the detail form with an appropriate
filter or Where equivalent to show the current record. You
could alternatively base the detail form on a query with a
parameter set to the key value on the continuous form.

--
Nick Coe (UK)
Available - Will work for money :)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.pjandcoe.co.uk/ Online Store

In WordFool typed:
 
W

WordFool

Thanks for that I seem to going in the right direction but how do I get the
appropriate filter on the detail form. I think I need some more instructions!!
 
S

sku

I'd make the field you want to click on in datasheet view display as a
hyperlink and when you click on it, it opens the form to that record. Two
steps:
1) Change the "Is Hyperlink" property of the field to "Yes"
2) In the "On Click" event, enter the code that will open the form and go
to the appropriate record. Here is an example, where EventName is the name
of the field in datasheet view that you want to click on, EventID is the
field (also in the datasheet record) that identifies the record, and
EventsForm is the name of the form to open. You'll need to change those
names for your purposes:

Private Sub EventName_Click()
On Error GoTo Err_EventName_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EventsForm"

stLinkCriteria = "[EventID]=" & Me![EventID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_EventName_Click:
Exit Sub

Err_EventName_Click:
MsgBox Err.description
Resume Exit_EventName_Click
End Sub
 
Top