Hi everyone
Just wanted your thoughts on something. So I created a form, as seen above that allows users to add new or edit existing agency information. On the main table, for the agency field, under "General", I set Required to Yes. Thus users MUST provide an agency name as this cannot be blank. Now for whatever crazy reason the user starts filling out the form, hitting save, without an agency name, they will receive a prompt message saying:
You must enter a value in the 'AgencyINFO.Agency' table
Everything is good so far. Now, I think most people would go "Oh shoot I forgot to enter their name" and type in an agency name. Problem solved. However, if for whatever reason the user decides they want to delete everything they just typed, they will be prompted with this message:
Run-time error '2105':
You can't go to the specified record
And when the debug window pops up, the vba for the Clear button shows up as:
Code:Option Compare Database Private Sub cmdClear_Click() DoCmd.GoToRecord , , acNewRec //this part is highlighted yellow End Sub
I can't think of many times for this particular project where users would start entering an agency's info without the agency name. Seems kind of obvious you'd have an organization's name first then start filling out their information. But I'm just thinking if they started filling out their info (e.g. address, email, phone number, etc.) without an agency name but decide they made a mistake and want to clear all the fields, they will be prompted with an error message they won't know how to interact with. From a developer's side, is there a way I can prevent this run time error? Thank you!