I have a form created to allow editing of a record in a table of people. The db is in SQL Server. Most of the columns are Not Nullable, e.g., Last Name, First Name.
This form (mostly) works when editing a record, that is, if I change a value such as name and save it. I am adding event code to detect whether any required fields are empty or the empty string, copying code I have working in the companion form that is used to add a new person.
The reason it is only "mostly" working is that if I click on a required field and delete all characters then click on another field this pops up:
I then added VBA to several events of the field in which the text was deleted, that just had a few debug.print commands so I could use a breakpoint. I tried the On Exit and On Lost Focus events. The error message box pops up before these events are triggered.
Advice from searches I have done is that Access tries to save the record at the time I click away from that field, which seems wrong to me (why try to save until the save button?). I can't make the table column nulable as it is required. I also can't figure out if there's some event I can "catch" with VBA code to warn the user without this unfriendly dialog. Basically, I am confused by the event model used by Access and exactly what it is doing to cause this, and how it can be improved.
Thanks!
This form (mostly) works when editing a record, that is, if I change a value such as name and save it. I am adding event code to detect whether any required fields are empty or the empty string, copying code I have working in the companion form that is used to add a new person.
The reason it is only "mostly" working is that if I click on a required field and delete all characters then click on another field this pops up:
I then added VBA to several events of the field in which the text was deleted, that just had a few debug.print commands so I could use a breakpoint. I tried the On Exit and On Lost Focus events. The error message box pops up before these events are triggered.
Advice from searches I have done is that Access tries to save the record at the time I click away from that field, which seems wrong to me (why try to save until the save button?). I can't make the table column nulable as it is required. I also can't figure out if there's some event I can "catch" with VBA code to warn the user without this unfriendly dialog. Basically, I am confused by the event model used by Access and exactly what it is doing to cause this, and how it can be improved.
Thanks!