Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Navigation with command buttons on main form

Status
Not open for further replies.

SyntaxCorrect

Programmer
Nov 29, 2002
5
0
0
CA
This request for information refers to an application that is being developed in Access 2000.

I am trying to apply the first record, previous record, next record and last record buttons on an Access main form so that when these buttons are pressed the cursor moves to the appropriate record location on an embedded subform in datasheet view. I have attempted to study and understand the Recordset.Clone method but am not sure if the code for the Recordset.Clone should go into the Master form or the subform and even then I am not sure how to get the pointer to move in the appropriate direction when I press these buttons.

Thanks in advance.

SyntaxCorrect
 
Dear SC

Yes, sure

4 the First ....
Forms![QWS].Recordset.MoveFirst
4 the next ....
Forms![SubformName].Recordset.MoveNext
4 the Previous ....
Forms![QWS].Recordset.MovePrevious
4 the Last ....
Forms![QWS].Recordset.MoveLast

Hope That Helps

Haitham
 
This question refers to an application that is being developed in Access 2000.

I am trying to apply the first record, previous record, next record and last record buttons on an Access main form so that when these buttons are pressed the cursor moves to the appropriate record location on an embedded subform in datasheet view.

I have had one response on this question to date. Since I am new to this Forum, can anyone tell me if it is possible to send another inquiry to the person that responded to the first question and how to go about contacting this person.

The response I received was:
For the first record button use, Forms![QWS].Recordset.MoveFirst
For the next record button use, Forms![SubformName].Recordset.MoveNext
For the previous record button use, Forms![QWS].Recordset.MovePrevious
For the last record button use, Forms![QWS].Recordset.MoveLast

So, assuming this works, I am not sure what QWS means and since the subform data was obtained from a query that generated subform, how do I access the "Recordset" in the Forms![QWS].Recordset.Move[First, Previous, Next, Last], if it is defined somewhere in the Access query generation wizard and not part of a QueryDef?

Thanks in advance.

SyntaxCorrect
 
Dear SC,

It was a mistake from me, QWS is for another Post i was busy with.
QWS = Ur SubForm Name So....

4 the First ....
Forms![SubformName].Recordset.MoveFirst
4 the next ....
Forms![SubformName].Recordset.MoveNext
4 the Previous ....
Forms![SubformName].Recordset.MovePrevious
4 the Last ....
Forms![SubformName].Recordset.MoveLast

Hope That Helps U
Good Luck

Saam001@yahoo.com

 
An initial attempt at using the following syntax:
Forms![frmSubFormName_subform].Recordset.MoveNext, fails and produces the following error.

Run-time error '2450'.
Microsoft Access can't find form 'frmSubFormName_subform' referred to in a macro expression or Visual Basic code.

Any help would be appreciated.

Thanks.

SyntaxCorrect
 
Dear SyntaxCorrect,

[SubformName], means your SubForm Name, what ever the name u have give it to ur SubForm, just type ur subform name in between [-----] that is it.

Hope that helps u

 
Dear Haitham:

Thanks for your advice, but does not matter what name I give to my subform, Access returns the Run-time error '2450' as identified in my previous notification.

Regards,

SyntaxCorrect
 
SyntaxCorrect,

The syntax was (slightly) incorrect in the previous postings. The proper syntax is:

forms!NameOfMainForm!NameOfControlThatHoldsSubform.form

"Forms" and "form" have to be exactly that (capitalization doesn't matter). The other parts get replaced with the names of your main form and the name of the control that holds your subform (which may or may not be the same as the name of the subform). The ".form" tells access that you want to refer to a property or method or member of the form, not the control that holds it.

Jeremy

PS: In forums, the way it works is that you just keep posting to the thread and people may or may not respond. It's generally frowned upon to contact people directly, unless you've asked their permission in the forum. And sometimes questions just don't get answered. But in general, these forums are quite good at answering people's questions. =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top