How to code form to open at next record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I would like to create a form to allow a user to 'add' new rows to a table
but not be able to modify or change any of the existing rows. So I created
the form based on the table.

First question:
How do I code this form on loading to go to a new row in the table. I tried
to use the onload event procedure by coding doCmd.FindNext but the macro
didn't work. I don't know VB you see so I'm not sure how to code this or even
if 'findnext' would be the appropriate code to actually find the end row
which should be blank.

Also, how can I ensure that the user can only 'add' and not 'modify' the
fields in the form.

Thanks so much, hope someone can help.
Angeline
Sydney
 
A couple of options:

a) Set the Data Entry property of the form to Yes.
The form will load to a new record, and not even show old ones.

b) Set the Allow Edits property of of the form to Yes.
The form will show old records, but they cannot be edited.
New records can still be added (assuming you leave Allow Additions as yes.)

To have the form go to a new record, add this code to its Load event
procedure:

If Not Me.NewRecord Then RunCommand acCmdRecordsGotoNew
 
Allen Browne said:
A couple of options:

a) Set the Data Entry property of the form to Yes.
The form will load to a new record, and not even show old ones.

b) Set the Allow Edits property of of the form to Yes.

Or rather, set it to No. I'm sure that's what Allen intended.
 
Allen,
Thank you very much for your advice, it was very helpful.

kind regards,
Angeline
 

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

Back
Top