null default values on a form

  • Thread starter Thread starter Mikhail Bogorad
  • Start date Start date
M

Mikhail Bogorad

Hi,

bet this question has been asked before: i have created a form so a
user can add new records and edit existing ones. For editing purposes
my form also has a search drop down by a record number. When i open
the form it always shows me the first record from the table, but i
just want it to be copmletely blank until a user choses his record for
editing. If i change Form properties (Data Entry =Yes) it works but
Search function does not work at all.

Thanks
Mike
 
Mikhail Bogorad said:
Hi,

bet this question has been asked before: i have created a form so a
user can add new records and edit existing ones. For editing purposes
my form also has a search drop down by a record number. When i open
the form it always shows me the first record from the table, but i
just want it to be copmletely blank until a user choses his record for
editing. If i change Form properties (Data Entry =Yes) it works but
Search function does not work at all.


If you want your form to start at the new (blank) record, but still show all
existing records, you can put this code in an event procedure for the form's
Load event:

'----- start of code -----
Private Sub Form_Load()

Me.Recordset.AddNew

End Sub

'----- end of code -----

The same effect can be achieved with:

'----- start of code (alternative) -----
Private Sub Form_Load()

RunCommand acCmdRecordsGoToNew

End Sub

'----- end of code (alternative) -----
 
If you want your form to start at the new (blank) record, but still show all
existing records, you can put this code in an event procedure for the form's
Load event:

'----- start of code -----
Private Sub Form_Load()

    Me.Recordset.AddNew

End Sub

'----- end of code -----

The same effect can be achieved with:

'----- start of code (alternative) -----
Private Sub Form_Load()

    RunCommand acCmdRecordsGoToNew

End Sub

'----- end of code (alternative) -----

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

Thanks Dirk!
 
Back
Top