"you can't save this record at this time" error on empty form! (1 Viewer)

shwan

Registered User.
Local time
Today, 08:39
Joined
Nov 18, 2017
Messages
13
Hello

I have a form with a subform that is based on a table with required fields. When the user enters something then delete it with backspace in keyboard and want to exit the form, an error message appears that say "you must enter a value in "field name" field, the form is completely empty and still this appears. I even have an undo button that when the user tries to click the message appears again. the only way to exit is by keep doing this until another message appears that says, you can't save this record at this time, do you want to exit anyway? and the user press yes
How can I handle this issue?

Thanks
 

isladogs

MVP / VIP
Local time
Today, 15:39
Joined
Jan 14, 2017
Messages
18,186
Your basic issue is having several required fields.
Do all NEED to be required?

If they do, you need to modify the code to allow a graceful exit
 

shwan

Registered User.
Local time
Today, 08:39
Joined
Nov 18, 2017
Messages
13
Your basic issue is having several required fields.
Do all NEED to be required?

If they do, you need to modify the code to allow a graceful exit

Thank you, yes they are all required. can you give an idea about that code? and why the undo button don't seem to do anything?
 

isladogs

MVP / VIP
Local time
Today, 15:39
Joined
Jan 14, 2017
Messages
18,186
Thank you, yes they are all required. can you give an idea about that code? and why the undo button don't seem to do anything?

You're making it harder than it needs to be.
If several fields are really required, this may be one occasion where using unbound controls will help. But you'll need a lot more code.

It will be guesswork providing specific advice unless you give more info.
Either that or post your db for one of us to look at
 

shwan

Registered User.
Local time
Today, 08:39
Joined
Nov 18, 2017
Messages
13
here is my database, it is a very simple database with two tables. one table contains customers information the other one contains their payments. the issue I'm having is in the frmpatients form. it is still an uncompleted project and I'm trying to learn while making this first database.
Thank you for your help.
 

Attachments

  • Database11.accdb
    1.8 MB · Views: 113

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:39
Joined
May 7, 2009
Messages
19,175
the code you want to look at on this
kind of event (it's no error actually),
is on the Form's Error Event:
 

Attachments

  • Database11.zip
    45.6 KB · Views: 207

shwan

Registered User.
Local time
Today, 08:39
Joined
Nov 18, 2017
Messages
13
the code you want to look at on this
kind of event (it's no error actually),
is on the Form's Error Event:

You are my hero, thanks a lot.
one more question if you don't mind I understand what Response = acDataErrContinue means, it will make the form behave as nothing happened. But I have difficulty understanding what Response = acDataErrAdded does and why you chose that over the first statement?
 

Users who are viewing this thread

Top Bottom