By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Goto Last Record and Open Form at same time ?

P: n/a
Hi,

I have managed to simplify my problem but can't seem to get this to work.

I want to open up a form from a click event of another form, but not only
open the form when the button is pressed but also move to the last record.

DoCmd.OpenForm "My-Form-Name", acNormal

Opens the form with no problem.....

But the next line....

DoCmd.GoToRecord , , acLast

DoCmd.Close acForm, Me.Name

Doesn't seem to get the form to move to the last record, only shows 1st
record of n.

And !!! I don't want to put the code:

DoCmd.GoToRecord , , acLast

into the form load event, or on open event either because I want it to only
move to the last record for my specific click event and not always when the
form is opened from other methods.

What am i missing here ? How do I code all this in one line ?

Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Try:

DoCmd.OpenForm "My-Form-Name", acNormal

docmd.gotorecord acDataForm, "My forname", acLast
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl******************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #2

P: n/a
Albert,

This does not work !

It opens the form no problem.

But the form opens at record 1 of n, and NOT on the last record.

There must be a way ? I have only been able to open the form to the last
record
if I place your second line in the form on open event, but then that is not
what I
intend to do, it needs to open from the click event to the last record -
only.

Let me know.
"Albert D. Kallal" <pl********************@msn.com> wrote in message
news:Napec.85464$oR5.82460@pd7tw3no...
Try:

DoCmd.OpenForm "My-Form-Name", acNormal

docmd.gotorecord acDataForm, "My forname", acLast
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl******************@msn.com
http://www.attcanada.net/~kallal.msn

Nov 12 '05 #3

P: n/a
I think I figured it out, you wouldn't believe it !

I had a line that closes my current form where the click even occurs, this
line of code was placed last in the
procedure. Intead I placed this line of code as the 1st line in the
procedure. For some reason it works
now.
"BLUE WATER" <no**********@nowhere.com> wrote in message
news:Ne**************@news04.bloor.is.net.cable.ro gers.com...
Albert,

This does not work !

It opens the form no problem.

But the form opens at record 1 of n, and NOT on the last record.

There must be a way ? I have only been able to open the form to the last
record
if I place your second line in the form on open event, but then that is not what I
intend to do, it needs to open from the click event to the last record -
only.

Let me know.
"Albert D. Kallal" <pl********************@msn.com> wrote in message
news:Napec.85464$oR5.82460@pd7tw3no...
Try:

DoCmd.OpenForm "My-Form-Name", acNormal

docmd.gotorecord acDataForm, "My forname", acLast
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl******************@msn.com
http://www.attcanada.net/~kallal.msn


Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.