How to design this form edit record scenerio?

  • Thread starter Thread starter Cheng-Liang Shen
  • Start date Start date
C

Cheng-Liang Shen

Hi All

I would like design a Main Form listing all the records in the table, then
then I can select one of the record and
hit Edit button to open another Edit Form to modify each record field with
the data lock protection. Then hit the
Save button to close the Edit Form and go back to Main Form. Could anyone
give me the direction how this could
be done in Microsoft Access? Appreciate the help.
 
Assuming your main form has a primay key named (say) "ID", you can use that
value in the WhereCondition of the OpenForm action to open another form for
editing:

Private Sub cmdEdit_Click()
If Me.NewRecord Then
Beep
Else
DoCmd.OpenForm "MyEditForm", WhereCondition:="[ID] = " & Me.[ID],
WindowMode:=acDialog
End If
End Sub
 
Back
Top