Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel Save

Status
Not open for further replies.

DoctorJDM

Technical User
Apr 15, 2007
60
GB
Have form which on repeatedly going to new records just keeps saving them even though nothing is being added, so ending up with lots of empty records.

I've used this procedure to check if the most important field is blank. It sort of works but eventually causes an untidy exit from the form when really I'd just like to leave the form open and allow navigating back to completed records.

Private Sub Form_BeforeUpdate(Cancel As Integer)

'Check if Customer field has been completed; if not don't save
If IsNull(Customer) Then
MsgBox "Customer not entered so record won't be saved"
DoCmd.CancelEvent
Else
DoCmd.Save
End If

End Sub

The form has a number of subforms each with totalled amounts. I'm bringing these up into unbound fields in the main form then using the form's OnCurrent procedure to set bound fields to these values for later reference.

Suspect this is an old chestnut but haven't found any refernce in the FAQs.
 
How about setting Allow Addirions to false? You could set it back on programmatically when you need to add a record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top