Data enntry form record navigation buttons add blank records

jpl458

Well-known member
Local time
Yesterday, 22:18
Joined
Mar 30, 2012
Messages
1,218
Have a data entry form, and just noticed that the record navigation buttons at the bottom of the form will add blank records once you go past the last record in the table. The last field in the tab list is Notes and it has some code in the lost focus event, would that cause the problem? or is there something I can set in properties.
 
If the problem is that you don't want to be able to add new records, then you can set the Allow Additions to No.
 
Have a data entry form, and just noticed that the record navigation buttons at the bottom of the form will add blank records once you go past the last record in the table. The last field in the tab list is Notes and it has some code in the lost focus event, would that cause the problem? or is there something I can set in properties.
Obviously, without looking at the code that runs in the Lost Focus event, no one in this forum can tell you if that is causing your "problem". So please post the code that runs when the Notes field loses the focus. Further, what do you mean by "once you go past the last record"? Do you mean a new record gets added when you didn't intend to add it? How do you normally add new records using the form? One thing for sure, if you set Allow Additions to 'No', no new records can be added at all until you set it back to 'Yes'.
 
Obviously, without looking at the code that runs in the Lost Focus event, no one in this forum can tell you if that is causing your "problem". So please post the code that runs when the Notes field loses the focus. Further, what do you mean by "once you go past the last record"? Do you mean a new record gets added when you didn't intend to add it? How do you normally add new records using the form? One thing for sure, if you set Allow Additions to 'No', no new records can be added at all until you set it back to 'Yes'.
 
Tabbing through the last control can allow Access to start a new record. I used that feature extensively for my data entry of one of my db's as it saved so much time.
I believe you can change it to just cycle the next control?

Look at the Cycle property on the Other Tab.
 
Here is the code that is in the lost focus event of the Notes textbox which is the last entry in the tab list.

Code:
Me.actionlbl.Visible = False
Me.arcode.Visible = False
    Me.st.Visible = False
    Me.callorigin.Visible = False
    Me.arcode2tb.Visible = False
    Me.st2tb.Visible = False
    Me.origin2tb.Visible = False

Say I have 25 records in the master table. Using the record navigation buttons at the bottom of the form, when I open the form the record count says 1 of 1, If keep scrolling through the records when I get to record 26, a blank line is entered into the master table, and if I keep going beyond that each time I hit the right-hand button blank records are written to the table. I seems to me that it should not do that, but stop on record 25, and not allow the user to go past that. I know that once you tab out of the last entry in the tab list a record is automatically written to the table, that part works. I thought that have code in the lost focus event might have something to do with the problem. I want to prevent blank records from being written to the table. Is there way of accomplishing that, or do I have to write code that interrogates fields and if blank don't write.
 
You do that with form validation?
 
I just found that you can define a field in the table as being "required" Or I can add this code to the Before Update event:
If IsNull(SomeField) or IsNull(SomeOtherField) Then msgbox "Record will not be saved. Please enter required data", vbOKOnly Cancel = True End If

The code looks like the better choice because it tells the user what's wrong.
 
After testing, the easiest way is to use the Required option in the table definition to define required fields
 

Users who are viewing this thread

Back
Top Bottom