From: Pedro on
Hello everyone
I have this procedure and suddnely it's not working.
I'm not an expert but it was ok.
It's like this :

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acLast
End Sub

And when i open this form, it goes to another record when it's suppose to go
to the last one.
Any ideas? Please help me.
Tks in advance
Pedro

From: Douglas J. Steele on
Try putting that code into the Load event, rather than the Open event.

The Open event fires before all of the data has been retrieved.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Pedro" <Pedro(a)discussions.microsoft.com> wrote in message
news:FFB8716D-F530-4F3E-BE8F-79FE427B41C7(a)microsoft.com...
> Hello everyone
> I have this procedure and suddnely it's not working.
> I'm not an expert but it was ok.
> It's like this :
>
> Private Sub Form_Open(Cancel As Integer)
> DoCmd.GoToRecord , , acLast
> End Sub
>
> And when i open this form, it goes to another record when it's suppose to
> go
> to the last one.
> Any ideas? Please help me.
> Tks in advance
> Pedro
>


From: Allen Browne on
You might get a better result by using the form's Load event:

Private Sub Form_Load()
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoLast
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Pedro" <Pedro(a)discussions.microsoft.com> wrote in message
news:FFB8716D-F530-4F3E-BE8F-79FE427B41C7(a)microsoft.com...
> Hello everyone
> I have this procedure and suddnely it's not working.
> I'm not an expert but it was ok.
> It's like this :
>
> Private Sub Form_Open(Cancel As Integer)
> DoCmd.GoToRecord , , acLast
> End Sub
>
> And when i open this form, it goes to another record when it's suppose to
> go
> to the last one.
> Any ideas? Please help me.
> Tks in advance
> Pedro

From: Pedro on
Ok. It's working. Last one :
Now if i would like to go to the highest value of a field and show me all
the record?
It's a numeric one.
ty in advance
Pedro

"Allen Browne" wrote:

> You might get a better result by using the form's Load event:
>
> Private Sub Form_Load()
> If Not Me.NewRecord Then
> RunCommand acCmdRecordsGotoLast
> End If
> End Sub
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Pedro" <Pedro(a)discussions.microsoft.com> wrote in message
> news:FFB8716D-F530-4F3E-BE8F-79FE427B41C7(a)microsoft.com...
> > Hello everyone
> > I have this procedure and suddnely it's not working.
> > I'm not an expert but it was ok.
> > It's like this :
> >
> > Private Sub Form_Open(Cancel As Integer)
> > DoCmd.GoToRecord , , acLast
> > End Sub
> >
> > And when i open this form, it goes to another record when it's suppose to
> > go
> > to the last one.
> > Any ideas? Please help me.
> > Tks in advance
> > Pedro
>
>
From: Allen Browne on
How about sorting the form so the highest value loads first:

Private Sub Form_Load()
Me.OrderBy = "[YourNumericFieldNameHere] DESC"
Me.OrderByOn = True
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Pedro" <Pedro(a)discussions.microsoft.com> wrote in message
news:B8DAE198-C832-45EA-8A5C-C52D29F65A38(a)microsoft.com...
> Ok. It's working. Last one :
> Now if i would like to go to the highest value of a field and show me all
> the record?
> It's a numeric one.
> ty in advance
> Pedro
>
> "Allen Browne" wrote:
>
>> You might get a better result by using the form's Load event:
>>
>> Private Sub Form_Load()
>> If Not Me.NewRecord Then
>> RunCommand acCmdRecordsGotoLast
>> End If
>> End Sub
>>
>> "Pedro" <Pedro(a)discussions.microsoft.com> wrote in message
>> news:FFB8716D-F530-4F3E-BE8F-79FE427B41C7(a)microsoft.com...
>> > Hello everyone
>> > I have this procedure and suddnely it's not working.
>> > I'm not an expert but it was ok.
>> > It's like this :
>> >
>> > Private Sub Form_Open(Cancel As Integer)
>> > DoCmd.GoToRecord , , acLast
>> > End Sub
>> >
>> > And when i open this form, it goes to another record when it's suppose
>> > to
>> > go
>> > to the last one.
>> > Any ideas? Please help me.
>> > Tks in advance
>> > Pedro