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

Goto New Record on Form Open event 1

Status
Not open for further replies.

RealKiwi

Technical User
Feb 26, 2004
41
NZ
I've trawled through the threads in this forum, and used some of the points I thought applied to my situation. But can anyone tell me why,

DoCmd.GoToRecord , , acNewRec

doesn't work in the form_open event? The form is bound to the table so I fully expected it to jump to a new record when it opened...

thanks
RK
 
Hi RealKiwi

Instead of GoToRecord try:
DoCmd.RunCommand acCmdRecordsGoToNew

They do pretty much the samething, but you need to make sure that you havn't got anything else in you code which cancels out the GoTo command.

What happens when you run it at the moment?

Mikee.

Do or do not, there is no try. - Yoda
 
Just get an error message: 2105 Can't go to the specified record.

I created a new form from scratch and it works, but still doesnt explain why the other one doesn't. I'm thinking that since the form with the error was a copy of another form, that the VBA code was somehow corrupted in the copy process... but that would just be an educated guess.

Think I'll just work with the new form, since time is money and all that. Thanks for the feedback Mikee

RK
 
No problem..

I've also had that problem in the past as well, something on a form doesn't work, but when I created a new form all was well.

Most strange.

Mikee.

Do or do not, there is no try. - Yoda
 
Hi

Could it be that in your original form you had allowadditions property set to false?

another point if you want form to always add a new record, look at the dataenry property, it may do what you require

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
M1kee,

I'm confused as to why you'd want to got to the trouble to code this. Just go to the form properties, click on "Data" set Allow Additions = Yes and Data Entry = Yes, and every time the form opens you're at a new record!

The Missinglinq

"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Hi Missinglinq

Yes agreed, but if you do it that way you can only have data entry and you can't view any other records in the form.

Mikee.

Do or do not, there is no try. - Yoda
 
Hello there,
i am trying to create a table and form where a user can select several options at one time, any ideas?
thanks in advance
Alph
 
4808, please start a new thread as your question is totally unrelated to the subject.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top