Private Sub cmdCreateVisitOrViewAddHistory_Click()
' Open a recordset for the Visit_tbl table
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim ID As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("Visit_tbl", dbOpenDynaset, dbSeeChanges)
ID = Me.txtPatientID.value
Debug.Print "ID value: " & ID
' Add a new record to the recordset
rst.AddNew
rst("PatientID_FK").value = ID
' Set other fields of the Visit_tbl record as needed
' Save the new record
rst.Update
' Close the recordset and release the database object
rst.Close
Set rst = Nothing
Set db = Nothing
' Open the Visit_frm form with a filter for the related PatientID_FK record
DoCmd.OpenForm "Visit_frm", , , "PatientID_FK=" & ID, acFormEdit, acWindowNormal
End Sub
This is a click event on main form. After it opens the linked second form, the Visit_tbl saves the data automatically. I dont want to save it until I click the save button on the Visit_frm.
Help please
' Open a recordset for the Visit_tbl table
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim ID As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("Visit_tbl", dbOpenDynaset, dbSeeChanges)
ID = Me.txtPatientID.value
Debug.Print "ID value: " & ID
' Add a new record to the recordset
rst.AddNew
rst("PatientID_FK").value = ID
' Set other fields of the Visit_tbl record as needed
' Save the new record
rst.Update
' Close the recordset and release the database object
rst.Close
Set rst = Nothing
Set db = Nothing
' Open the Visit_frm form with a filter for the related PatientID_FK record
DoCmd.OpenForm "Visit_frm", , , "PatientID_FK=" & ID, acFormEdit, acWindowNormal
End Sub
This is a click event on main form. After it opens the linked second form, the Visit_tbl saves the data automatically. I dont want to save it until I click the save button on the Visit_frm.
Help please