View Full Version : New record


Rich
02-04-2001, 04:43 AM
I'm sure this has been answered before but I can't find it.
Is there anyway to hide the new record row on a continuous form untill the new record button is selected?

Fornatian
02-04-2001, 06:45 AM
Rich,

This one's possible but a bit unwieldy. The way to do it is to:

1.Add a new field to your table to use as a hidden indicator(Yes/No will be fine) called NewRec.

2.Set the forms properties of data entry to NO

3.On the add record button click open the forms recordset, add a new record and set the NewRec field to true. Also remember to include any foreign key fields and required fields or you will cause run-time and operatinal errors
This will create a new record in the background.

4.Requery the forms data and use gotorecord to set the focus to the last record

So actually what is happening is -

you are creating a record behind the scenes and then adding it to the forms source data, requerying the source data and showing the 'new' record to the user(when actually you are just allowing them to edit the one you just created). Hard work but I think it does look more professional.

Ian

Rich
02-04-2001, 08:03 AM
Thanks for the inspiration Ian
I actually came up with removing the record selectors which I don't need, AllowAdditions no.
Added new command button with following
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Richie

Fornatian
02-04-2001, 10:20 AM
Sounds like a better way, think I'll use that one!!