Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I start a form at the end of a table?

Status
Not open for further replies.

ErikZ

Programmer
Feb 14, 2001
266
US
The user will input name, ph number and email, but when they open the form, it displays the first record. How do have it open on the last record, the blank one where you input?

I want them to be able to go back and edit previous records, so starting the form in "Data Entry" mode won't help.
 
I usually have a query that searches for the record. If found, I open in edit mode. If not, I open in Add mode. Someone else may have a better solution... Terry M. Hoey
 
Hm, is this doable with a Macro? I'm trying to cobble something together, but Access isn't buying it.

It wouldn't be so bad if I could call this macro with any of my forms and have them start at the bottom of the table.
 
Erik, in the open event of the form put:

DoCmd.GoToRecord , , acNewRec
Maq B-)
<insert witty signature here>
 
You can do this with a macro, called from each form's On Open event, but it's probably just one simple line of code. Use the GoToRecord action and Record: New.
 
I think the others have missed the point. One form used to edit AND add records. I am not sure if/how to do it in a macro. I always do it in the CODE of a button (ON_CLICK event). Terry M. Hoey
 
The question asked was how to open a form at the new record while still having the rest of the records available for editing. If searching to see if a records exists already is part of the question, that can be worked into a macro too, but a little more detail of the problem would be helpful.
 
Woah guys! Maquis came up with a decent solution. I really did give all the info on the job. So now when the form comes up, the use doesn't have to hit anything to start adding records. If they want to edit a revious record, they can use the forms built-in record traversal buttons.

Program-wise, I was hoping to come up with a single function I could call, instead of inserting the same code for each form. Feels wasteful. :)

I'm going to check out the macro that tempclerk gave, even though I've already added the VBA code that Maquis gave.
 
Woops... Ok, I am the one that misread it. My fault. Glad you got a suitable answer... Terry M. Hoey
 
I tried to use Maquis' Open Event code, but when I open the form, I get the error &quot;Can't find the macro DoCMD&quot;.

Did I miss something? :-I
 
jthomas, where did you put the docmd? It belongs in VB code.

Open up the properties and goto to the on_open or on_load event box and click the &quot;...&quot; button off to the side. Select code builder and type your docmd in the subroutine that comes up. Maq B-)
<insert witty signature here>
 
The property box should say [Event Procedure]. Click the builder to the right of the box to get the code builder, and put the code in there.
 
That got it! Thanks a lot. It seems like a little thing, but being able to open the form to a new record really makes life easier.

It's scary...Five years ago, I was a medievalist.
Now I'm an Access junkie.

(-:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top