Angelo,
 
    Basically it involves use of DoCmd.GoToRecord method after setting focus on the subform control.
 
    Sample code is given below. SF_1 & SF_2 are the names of subform controls. On Error Resume Next statement is meant to prevent error message while trying to move prior to first record (by acPrevious argument) or beyond the new record (by acNext argument).
 
Best wishes,
A.D.Tejpal
 
==================================
Private Sub CmdFirst_Click()
    On Error Resume Next
    SF_1.SetFocus
    DoCmd.GoToRecord , , acFirst
    SF_2.SetFocus
    DoCmd.GoToRecord , , acFirst
End Sub
-----------------------------------------------------------
Private Sub CmdLast_Click()
    On Error Resume Next
    SF_1.SetFocus
    DoCmd.GoToRecord , , acLast
    SF_2.SetFocus
    DoCmd.GoToRecord , , acLast
End Sub
-----------------------------------------------------------
Private Sub CmdNext_Click()
    On Error Resume Next
    SF_1.SetFocus
    DoCmd.GoToRecord , , acNext
    SF_2.SetFocus
    DoCmd.GoToRecord , , acNext
End Sub
-----------------------------------------------------------
Private Sub CmdPrev_Click()
    On Error Resume Next
    SF_1.SetFocus
    DoCmd.GoToRecord , , acPrevious
    SF_2.SetFocus
    DoCmd.GoToRecord , , acPrevious
End Sub
==================================
 
----- Original Message -----
Sent: Monday, July 18, 2005 10:56
Subject: [AccessDevelopers] replacing vertical scroll bars with button

Hi,
 
I'm trying to programatically replace the vertical scroll bars of a sub form with buttons.
 
I have a form which has 2 sub forms. I need to link the vertical movement of the subforms so they are in sync.
I'm trying to do this by removing the vertical scroll bars from the sub forms, and having 2 buttons on the main form (one for up, one for down). I need the buttons to move the records in the sub forms accordingly.
 
Any ideas appreciated.
 
Thanks,
Angelo



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to