-
Open form
I would like to know if there is a way of opening a form to add a new record. But on opening it appends to the last record instead of opening at record 1.
for instance if I have x records I want to open the form with a command button and it will go to record x+1 instead of record 1.
Rob
-
DoCmd.OpenForm "frmParticipants", , , , acFormAdd
Will open up a form in data entry mode.
This is the simplest solution (I think) to what you are after (which I am not really sure about).
Otherwise you can open the form with an Opening Arg and in the load event something like
If me.openarg = "your open arg" then
DoCmd.GoToRecord acActiveDataObject, , acNewRec
end if
I am not entirely sure I understand you though.
HTH,
Peter
-
The thing that I am asking say for instance I have 50 records. When opening the form I want it directly to go to a new record 51 with out happening to open to the first record. I believe by default when opeing a recor it goes to record when then you have to go to the last record before entering data. I want to be able to open the form and just type in data.
-
My first suggest will go directly to the new record, but will not show the other 50 records.
Suggestion 2 will show the 50 and go to a new record.
I haven't tested the second but I'd be surprised if it didn't work.
HTH,
Peter
-
In the On Open event use this code
DoCmd.GoToRecord , , acNewRec
This will open on a new record each time
-
But do you want that as the default behavior of your form?
Best to have the form dynamically respond to an OpenArg I reckon.
-
In the form design do the following:
right click to open Build open, choose Macro Builder, select a macro name. In the Action menu, choose GoToRecord. At the bottom, select Object type- form, Obj. name- your form's name, Recor- New.
Save the macro & the form and recall the form. i hope this will solve the record problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|