-1

Hi I am working on patient management tool where in i wanted to have patient engagement status fields as open,close and reopen. when i change the closed patient to reopen it should add it as new record instead of updating the current record. I have tried to do it in the "cmdsave" to check for status and then add as new or update. the issue is whenever i changed the combo box, the value is getting saved in the table even before i clicked the save command.

Private Sub CmdSaveEng_Click()
On Error GoTo CmdSaveEng_Click_Err

   On Error Resume Next

   Call checkReopenexists

   If pExists = False Then
      saved = True
      Call addNewRecord
      Me.CmdSaveEng.Enabled = False
      saved = False
      Exit Sub
   Else

saved = True
DoCmd.RunCommand acCmdSaveRecord
Me.CmdSaveEng.Enabled = False
saved = False
If (MacroError <> 0) Then
    Beep
    MsgBox MacroError.Description, vbOKOnly, ""
End If
Beep

MsgBox "Data Saved Successfully", vbInformation, "Save"
End If

CmdSaveEng_Click_Exit:
    Exit Sub

CmdSaveEng_Click_Err:
    MsgBox Error$
    Resume CmdSaveEng_Click_Exit

End Sub
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

You can't do it that way.

Create a button that will create a copy of the current record, then move to the copied record for further editing:

Copy record to new record

Gustav
  • 53,498
  • 7
  • 29
  • 55