GoTo specific line item in continuous sub-form?

Meltdown

Registered User.
Local time
Today, 04:33
Joined
Feb 25, 2002
Messages
472
Hi all,

I have a continuous sub-form -- on the main form I want to put a button, that when clicked goes to or sets the focus to the fifth record in the sub-form, how would I do that please?

Regards
Melt
 
I think you should be able to do this by using the
Code:
[URL="http://msdn.microsoft.com/en-us/library/bb237964%28office.12%29.aspx"]DoCmd.GoToRecord[/URL] acDataForm, "YourSubForm", acGoTo, 5
 
I suggest to put a command button in the subform.
Look at "DemoSubLA2000.mdb" (attachment, zip).
Open frmMain and try.
Look at frmSubform - VBA.
 

Attachments

Thanks for the replies guys, problem sorted.

Regards
Melt
 
You do know that a particular record isn't necessarily going to be that same record number each time, don't you? Records are not stored in the table in any particular order (think of it as a big bucket where things get thrown in and may slosh from side to side). Unless you have some ORDER BY clause in a QUERY that you use underlying that form, you are at the mercy of Access of how it provides it. Many people mistakenly assume that records are stored in the order they were input because many times it will appear that way on the form. But that is a complete erroneous way to think about it and it can bite you at any time.

Also, record numbers in this case, only are good for the session you are currently in. If you requery the form, or close and reopen, the record number for a particular record may, and can easily, change. So if you want a specific record each time you will want to use it's primary key to select it, not the record number.
 
I'm still trying to figure out the advantage of clicking on a button on the main form rather than simply clicking on the desired record on the subform! :confused:
 

Users who are viewing this thread

Back
Top Bottom