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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening form in a certain mannor 2

Status
Not open for further replies.

RnRExpress

Technical User
Oct 24, 2004
53
US
I have a database with one form. And what I would like to do is this:

1) Have the form open up to the very last record entered before the program was closed. Not the last saved, but the last record.

2) When adding a new record, to have the cursor automatically start on the very first text field, instead of the field the cursor was on before starting the new record.

Thanks again!!
 
1)DoCmd.GoToRecord acDataForm, "FormName", acLast
2)Me![1stControlName].SetFocus

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hey PHV,

The first one worked perfect. Thanks again.

The second one, doesn't seem to work. maybe if I explain how I do this, I may need to do this another way.

After I enter the info on my form, I usually just click the >* at the ottom of the form to start a new record. I put the code in line #2 from above, and the cursor still stays in the same exact field it was in, when I clicked on >*

Any way of making sure the cursor gets into that first field, after clicking the >* ? Or maybe I am not putting your code in the proper location.

thanks again for all the awesome help!

Richard
 
Try to put the SetFocus code in the Current event procedure of the form.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Try this in the OnCurrent event of your form...
If me.newrecord then me.ControlName.setfocus

Randy
 
to Randy, PHV:

thank you both. I tried both and both worked. I just wasn't putting it into the Current event.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top