Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigation buttons - not recognizing end of recordset

Status
Not open for further replies.

marionvgc

Programmer
Feb 12, 2002
3
0
0
US
Hello, I have a database that I have just recently made revisions to. I am using the navigation buttons that allow you to navigate between records, to the first record, to the last record and to create a new record. Previously, when the user reached the last record, the 'go to last record' arrow would be deactivated. It is no longer doing that and this is causing problems because (1) users are creating empty records and (2) required fields are not being validated (validation only occurs when the user clicks 'Save and Close Record' or clicks 'Add New Record'. Please help!
 
In the form's properties, set the "Allow Additions" to No. Then create a button which sets "DataEntry" to True when you want to add a new record. This is the easiest way to handle this situation without writing code to manage the recordset.

mac
 
mac318, I tried as you suggested and am receiving the following error message "You can't go to the specified record. You may be at the end of a recordset." In the button's On Click event I have entered the following code:

Me.Form.DataEntry = True
DoCmd.GoToRecord , , acNewRec

Is this correct? Do I need to add anything else?
 
Well, I was finally able to get it to work by modifying the button's On Click event slightly:

Me.Form.AllowAdditions = True
Me.Form.DataEntry = True
DoCmd.GoToRecord , , acNewRec

Now, the navigation buttons are enabled and the user can still click the right arrow button and advance to a new record WITHOUT having to click the Add New Record button (thereby bypassing the field validation). Has anyone ever encountered this problem or know a way to resolve it?
 
In the Current Form event:
Me.Form.DataEntry = False

This will prevent a new record from being added until the Add Button is pressed.

mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top