Open a Form to edit data

  • Thread starter Thread starter NDClark
  • Start date Start date
N

NDClark

I can make my data in the datasheet view a double-click to open a form.
However, I would like my form to open to the specific data that I am
double-clicking in order to edit it.

I know you can just click the data in the datasheet and edit. I want the
user to use the form to edit the data in the data sheet.

If you can offer any suggestions it would be greatly appreciated.
 
Open the datasheet form in design view
Right click outside the details area (the grey section)
Select OnClick (of the form not the records)

Private Sub Form_Click()
DoCmd.OpenForm "SomeFormName", acNormal, "",
"[ID]=[Forms]![DateSheetFormName]![ID]", , acNormal
End Sub

Note - this
DoCmd.OpenForm "SomeFormName", acNormal, "",
"[ID]=[Forms]![DateSheetFormName]![ID]", , acNormal
is on one line

This will open SomeFormName at the record you have selected in the
datasheet. You may want to add a close event on the datasheet when you open
the SomeFormName like this


Private Sub Form_Click()
DoCmd.OpenForm "SomeFormName", acNormal, "",
"[ID]=[Forms]![DateSheetFormName]![ID]", , acNormal
DoCmd.Close acForm, "DataSheetFormName"
End Sub


Hope this helps
 
Back
Top