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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Navigator hasn't advanced when opening form after exiting 1

Status
Not open for further replies.

elviajero

MIS
Feb 8, 2001
40
US
I have a form that has a command button which opens another form. I want the second form to open on a new record to add. I have the following code on the command button on the first form:

DoCmd.OpenForm "frm_LocAdd", acNormal, , ,acFormAdd

Then on the second form, I have Data Entry in form properties set to Yes.

The problem is that when I add and save a series of records, the record navigator advances with each new record I add. However if I exit this form and go back in, the record navigator resets to 1 every time and I can't navigate back to any previous records.

If I open the table in datasheet view the records have been saved and are indeed there.

What gives? Any ideas would be greatly appreciated.
 
As Microsoft bug reports so often say, "this behavior is by design." When you set Data Entry to Yes, you're specifying that you only want to use the form to add records. The record counter gives a count of the records in the recordset, but when Data Entry is Yes, the recordset consists only of the records added in the current incarnation of the form. If you close and reopen the form, the recordset is empty again, because it doesn't include records that existed at the time the form was open. That's why the record counter restarts at 1 each time.

If you want to position to the "new" record, but still be able to navigate to existing records, simply set Data Entry to No. Because you're using acFormAdd on your OpenForm call, it will still position to the "new" record, but you'll be able to navigate to existing records from there. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top