required entry on table level creating problems

What

Registered User.
Local time
Today, 14:47
Joined
Oct 28, 2009
Messages
14
I have an application entry form that has combo boxes to display the existing name records. Currently if someone searches through the combo boxes and hits the "add name" button upon realizing the name is not in the system, an error is thrown asking for input into the phone field. This could also happen if someone (perhaps even accidentally) starts to create a new record and changes their mind partway through and instead wants to navigate/search through the existing applications.

I want to require the application be submitted in its entirety. No partial data input, only complete records. Does anyone have ideas on preventing the error messages while also only permitting complete record entry?
 
I prefer to use the BeforeUpdate event of CONTROLS and FORMS for validation where you are in complete control of the messages. I also use the NotInList event of the ComboBox control to add to the RowSource of the cbo rather than a "Add" button. Just my $0.02
 
Thanks for the information. I will keep your suggestions in mind, but in the case of adding an application I'm not sure I can get away with using the notinlist event since it would mean needing to input a complete name record instead of an application record. I fear that using the notinlist function would have typos creating new partial name records, opening the door for a lot more to go wrong.

This code is for the names form, not to be confused with applications form, both forms are effected by the bug described by my original post.

I tried to examine the default VB code inserted into a wizard created "delete record" button, but couldnt really understand how it was deleting the record. Since it's not something you really want to be ambiguous, and my google/forum search-fu can't come up with the magic phrase - what do I need to replace the XXXXXX's with in order to abandon the record entry? You might not be able to give me exactly what I need, but I could not locate the syntax, so an example would work just as well.

Any help would be appreciated!
Code:
Dim choice As Integer

choice = MsgBox("It appears you have attempted to enter an incomplete record, would you like to abort entry?  Choosing yes will delete the current record.", vbYesNo, "Uh-oh...")
            Select Case choice:
            Case vbYes          'Delete Current record
                XXXXXXXXXXXXX
                DoCmd.Requery
            Case vbNo           'Give user list of required fields
                MsgBox "You are required to input: First & Last name, Address, Zip, and Phone.", vbOKOnly
            End Select
 
Me.UnDo will undo any changes made to an existing record on a form.
 
The definitive code for deleting a record would be

DoCmd.RunCommand acCmdDeleteRecord

but this won't work on a record that hasn't been saved. On an unsaved record you'd have to undo the record as Allan has indicated.

BTW, the approach Allan gave for this whole situation is not just his opinion but pretty much SOP for most experienced developers.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom