Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15795

MsOf365 VBA Access Form - Saving Blank Records

$
0
0
Hi there,

I've got a form I'm designing in the latest version of Access (2020/2021/O365?) and it's a "continuous" record form.

Meaning, it's got the built-in controls at the bottom for first, last, next, add new, etc.

It's mostly a tab-driven form, so, if the user enters data and hits "tab" until a new record is created, it seems as though my database will automatically save that blank record to the database.
It's a simple form, really, with the form linked to (data record source), one single table.

I'm attempting to prevent blank records from entering the database but I'm having trouble seeming to get it to do what I need.

I know I can use VBA in the Form BeforeUpdate event, but I can't seem to get it to trigger correctly / do what I want. There is a "save" button on the form, that performs the DoCmd.Save function, but even if the user blows past this button, it still moves onto creating a new / next / empty record, which is fine. They don't need to save until all records are entered.

I also am aware that I can put vba code to check for blank fields into my button, but this form is built for speed, so they shouldn't need to actually use the save button until all records are entered.

How do I do the following:
  1. Before moving to a new record, if the "current" record is blank, do not continue and simply give them an error message and send them back to the blank field
  2. If they partially enter data, but not all of the required fields, ask them, do you want to save? ///THIS SHOULD OVERRIDE THE BLANK DATA REQUIREMENT SO THEY CAN SAVE "IN PROGRESS" ITEMS
  3. Allow for them to start a new record, but if they haven't entered data yet, they *should* be able to move backwards to the previous item on the list, discarding the 'new' record and simply going back one record, without any prompt
  4. If they *tab* into a new record, save the previously entered record, I'm assuming I can just add the DoCmd.Save function here, but perhaps there's a better way?


Thanks in advance
*(I've been writing .NET apps for ages now and I've forgotten most of my VBA "intricacies" and "limitations". ;) )

Viewing all articles
Browse latest Browse all 15795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>