Single Record ADD and EDIT form

  • Thread starter Thread starter Nikos
  • Start date Start date
N

Nikos

Hello,

I apologise if this is a silly query, but I have the following issue.

I made a database and have a form for Adding data. This has the "allow
filters, allow edits, allow deletions, allow additions and data entry"
settings set to YES. Works fine.

I also wanted a form to edit data.I copied the "add" form, changed the
"data entry" setting to NO (so that it only allows editing of a single
record).

I have a form that lists the records and have a button with the
following code that opens up the "edit" form with the selected record:

On Error GoTo Err_btn_select_patient_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FrmDataEdit"
stLinkCriteria = "[serial]=" & Me![Serial]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btn_select_patient_Click:
Exit Sub
Err_btn_select_patient_Click:
MsgBox Err.Description
Resume Exit_btn_select_patient_Click
End Sub

and now.. THE PROBLEM:

I needed to change something on the dataset and on the layout of the
Data entry form. I then realised that I had to make identical changes
to the "edit" form.
Silly set-up eh?

So.. THE QUESTION (finally) is:

How can I have a single form for adding records, but open it up with
"data entry" set to NO, so that it can be used to edit a record
selected and opened with the button (that currently hold the above
code).

Thank you very much,

Nikos
 
It may be easier for you if you set up the single Form as normal add/edit
Form and use the "DataMode" argument of the OpenForm method to specify
whether the Form is to be opened in Edit or Add mode.

Check Access VB Help on the arguments of the OpenForm Method.
 
Back
Top