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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Records in a sub form

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I thought I submitted this earlier but I do not see it so...I have a Form with two subforms. On both subforms I want a command button to cause the subform to go to the next record. I tried a macro action GoToRecord-Next. When I click the button it runs the macro but the macro fails saying the subform (name) is not open.

Can someone help me with something that will work. My users do not like the standard MS Access record controls so I am using a large Command button.

Thanks,
 
my guess without seeing your code is that you are calling the subform by its name. If a form is instantiated as a subform you can not refer to that instance by its name:.
Example.
Main form: "frmMain"
sub form: "frmSubFrmOne"
sub form control on main form: "cntrlSubFrmOne"

from the main form you can not refer to the subform by

forms("frmSubFrmOne") or forms!frmSubFrmOne

you can refer to it by the form within your subform control

me.cntrlSubFrmOne.form
 
MajP,

Ok...that would mean I cannot use the macro action GoToRecord - Next, because it works off a list of objects types and object names. It does not allow any modificeation.

So...I want to put a control (Command button or someting) on the Subform that when clicked will would advance the subform to the next record.

What kind of code would do this....can you give me an example.

Thanks,
 
How are ya puforee . . .

Try the following in a command button:
Code:
[blue]   If Me.CurrentRecord <> Me.Recordset.RecordCount Then
      DoCmd.RunCommand acCmdRecordsGoToNext
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Sorry I assumed that you were trying to move the subform records from a control on the main form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top