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

Scrolling a subform via mainform command buttons 1

Status
Not open for further replies.

inso18

Technical User
Dec 30, 2006
147
IL
Hello folks. Since there's a very limited place in my form for a subform, I'm intersted in replacing subform's vertical scroll bar with main form command buttons. I've tried this code, but it doesn't work:

Me.subfrmSubForm.SetFocus
SendKeys "{PGUP}", True

Do you have a suggestions on how to make this work?
Regards, Michael.
 
You may be better off with something like:

intAP = Me.[Name of Subform Control].Form.Recordset.AbsolutePosition
Me.[Name of Subform Control].Form.Recordset.AbsolutePosition = intAP + 10
 
Thanks for your reply, Remou

I've done what you've suggested and got the following error: "Object variable or With block variable not set"

Any ideas why and what is possible to do?
 
Try this:

Code:
intMove = 10
intAP = Me.[i][Name of Subform Control][/i].Form.Recordset.AbsolutePosition
If [i][Name of Subform Control][/i].Form.Recordset.RecordCount - intAP < 10 Then
   intMove = Me.[i][Name of Subform Control][/i].Form.Recordset.RecordCount - intAP
End If
Me.[i][Name of Subform Control][/i].SetFocus
DoCmd.GoToRecord , , acGoTo, intAP + intMove

 
The 2nd line of your code gets the same error. Should I create a DAO recordset variable maybe? Also, I have only 1 record in this subform as it is a subform with many filters, for filtering the main form.
 
I don't think that will help. Try the RecordsetClone, rather than the Recordset, to see if that helps:

[tt]intAP = Me.[Name of Subform Control].Form.RecordsetClone.AbsolutePosition[/tt]

As an aside, I think I used to have this probelme with my version of Access (2000), until I applied some Office service packs. You may also be short an update to the Jet engine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top