Using ONCLICK on a form to retrieve a record

  • Thread starter Thread starter Richard B.
  • Start date Start date
R

Richard B.

Please help!!! I have a form that brings up rows of
records. I would like the user to mouse click on the
record id field (which is a autonumber)and have it call up
another form showing the clicked on record and all its
fields.

Thanks.
 
Richard B. said:
Please help!!! I have a form that brings up rows of
records. I would like the user to mouse click on the
record id field (which is a autonumber)and have it call up
another form showing the clicked on record and all its
fields.

This is simple enough -- just write an event procedure for the RecordID
field. If the detail form is called "frmDetails", your code might look
something like this:

Private Sub RecordID_Click()

DoCmd.OpenForm "frmDetails", _
WhereCondition:="RecordID=" & Me.RecordID

End Sub

You would also have to substitute the name of the primary key field for
"RecordID" where it appears in the above code.
 
Back
Top