Hello...
I am having a little bit of an issue here... If a user of my form is midway filling the fields, but for whatever reason decides to close the form midway doing it, the record will go to my table but the blank fields will remain blank. This is a really big issue for me because it's easy to end up with a bunch of incomplete records. It's very annoying frankly.
I used VB code to counteract this:
Code:
Private Sub Form_Close()
If pflag = 1 Then
'Do nothing because we know it's fine. Some other part of my code sets the flag to 1 if the record is complete.
Else 'The record has NOT been recorded
If MsgBox("Are you sure you want to close the form? If you do, the current record will be lost.", vbExclamation + vbYesNo, "You sure?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Else
MsgBox "Undo was aborted.", vbInformation
End If
End If
End Sub
The code will basically ask the user if they want to quit with incompleted details. If they do, it will select and delete the current record, so my database doesn't have incomplete ones. This is all fine and dandy, however I get the 2046 error on the DoCmd lines, because they are "not available". I really don't understand why, the property settings of my forms are set fine. Data Entry is set to Yes, and so is Delete and Edit, as well as Add. So I don't get why this is happening...