null default values on a form

  • Thread starter Mikhail Bogorad
  • 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
 
D

Dirk Goldgar

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) -----
 
M

Mikhail Bogorad

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top