Change record showing in form

victorh

Registered User.
Local time
Today, 07:37
Joined
Dec 14, 2005
Messages
14
Hello,

I have another question about ACCESS forms. With VBA, I want to change the record showing when I open a form.
I see there is a member "CurrentRecord" so I tried in the class module

Me.CurrentRecord = 2

I compiles but gives runtime error that is write-protected and cannot be changed. In the ACCESS help I read you could do it but HOW?

What should I do ( I am using ACCESS 97 ) ?!

Thanks in advance

Victor


PS : Is it true that VBA in newer versions of ACCESS has more features/functions etc?
 
CurrentRecord is not a "Write" setting. It simply tells you the current record displayed on the form.

What is your criteria for setting the record displayed on your form?
 
Hello reclusivemonkey,

I guess the value of the primary key is best...?

Thanks for the reply!
 
OK, you can select a record by Primary key simply by adding a dropdown to your form with the wizard. Or are you wishing to start at a particular primary key? Bit more background would help.
 
Exactly, I want to start out at a particular key...
 
Victor,

OK, how are you determining the particular key? Is it the same key every time, or will it differ on some other criteria?
 
Try the following

Private Sub Form_Load()

DoCmd.GoToRecord , , acGoTo, 2

End Sub

where 2 is the ID of the record.
 

Users who are viewing this thread

Back
Top Bottom