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
Douglas J. Steele - 14 Dec 2007 13:41 GMT
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.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Hello everyone
> I have this procedure and suddnely it's not working.
[quoted text clipped - 11 lines]
> Tks in advance
> Pedro
Allen Browne - 14 Dec 2007 13:50 GMT
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

Signature
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.
> Hello everyone
> I have this procedure and suddnely it's not working.
[quoted text clipped - 11 lines]
> Tks in advance
> Pedro
Pedro - 17 Dec 2007 16:19 GMT
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
> You might get a better result by using the form's Load event:
>
[quoted text clipped - 19 lines]
> > Tks in advance
> > Pedro
Allen Browne - 18 Dec 2007 00:24 GMT
How about sorting the form so the highest value loads first:
Private Sub Form_Load()
Me.OrderBy = "[YourNumericFieldNameHere] DESC"
Me.OrderByOn = True
End Sub

Signature
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.
> Ok. It's working. Last one :
> Now if i would like to go to the highest value of a field and show me all
[quoted text clipped - 27 lines]
>> > Tks in advance
>> > Pedro