Saving Record

mohammadagul

PrinceAtif
Local time
Tomorrow, 00:38
Joined
Mar 14, 2004
Messages
298
Hello everyone,

I have a form with subform in it.
Main for is Single
Subform is Tablular or Continuous.

These are two problems I am facing now.

Problem no1: Record Confirmation
I want the user to get a record confirmation message when they add or modify the record. Presently this is what I am using

Private Sub Form_BeforeUpdate (Cancel As Integer)
Dim updRecord As Byte

UpdRecord = MsgBox ("Confirm Record Change!", vbOKCancel, "Update Changes.")

If updRecord = vbCancel Then
Cancel = True
End If

Exit_Form_BeforeUpdate:
Exit Sub

Err_Form_BeforeUpdate:
MsgBox err. Description
Resume Exit_Form_BeforeUpdate
End Sub

The problem is that if I Place this code on the Before update event of Main Form it only works when I jump from main to sub form.

If I place this code on the Before update event of the sub form then it asks confirmation after each record.

How can I set this confirmation message that whenever I add new record it should appear when I have finished all the entries in the main and sub form?

Problem No 2:

Similar is the case with Delete button, if the delete button is in main form it deletes only records from the main and leaves the subform data as it is. I want the delete button to delete all the record entry from the main and subform corresponding to the Invoice ID
 
To answer your second question first, just set the Cascade Delete Related Records in the Table relationship window.

To answer your second question you can't Undo a main form entry after you've entered the subForm the main record has already been saved.
All you can do is add a boolean field to the table, update it when new records are added and if the user doesn't want to "save" delete the records
 

Users who are viewing this thread

Back
Top Bottom