V
Vítor Barbosa
Hi all,
I'm having some difficulties to solve a problem:
1) I have 3 forms: Main > Internamentos > sbfrmBotõesNavegação
2) Internamentos is a Main subform that uses sbfrmBotõesNavegação as a
record navigation buttons, like Stephen Lebans do with this sample:
http://www.lebans.com/recnavbuttons.htm
3) My problem is that the original code works when Internamentos is opened
as main form but not when it is opened as a subform of Main
4) My Next button code, for example looks like this:
----------------------------
Private Sub btnSeguinte_Click()
On Error GoTo Err_btnSeguinte_Click
If adhIsSubForm(Me.Parent) = False Then
DoCmd.GoToRecord acDataForm, Me.Parent.name, acNext
Else
On Error Resume Next
Forms(Me.Parent.Parent.name).Controls(Me.Parent.name). _
Form.Recordset.MoveNext
On Error GoTo Err_btnSeguinte_Click
End If
Exit_btnSeguinte_Click:
Exit Sub
Err_btnSeguinte_Click:
MsgBox Err.Description
Resume Exit_btnSeguinte_Click
End Sub
----------------------------
PS: adhIsSubForm is a function that checks if Internamentos is a subform or
a form
5) My error occurs here:
Forms(Me.Parent.Parent.name).Controls(Me.Parent.name). _
Form.Recordset.MoveNext
6) What's the problem?
TIA,
Vítor Barbosa
(Portugal) www.euro2004.com
I'm having some difficulties to solve a problem:
1) I have 3 forms: Main > Internamentos > sbfrmBotõesNavegação
2) Internamentos is a Main subform that uses sbfrmBotõesNavegação as a
record navigation buttons, like Stephen Lebans do with this sample:
http://www.lebans.com/recnavbuttons.htm
3) My problem is that the original code works when Internamentos is opened
as main form but not when it is opened as a subform of Main
4) My Next button code, for example looks like this:
----------------------------
Private Sub btnSeguinte_Click()
On Error GoTo Err_btnSeguinte_Click
If adhIsSubForm(Me.Parent) = False Then
DoCmd.GoToRecord acDataForm, Me.Parent.name, acNext
Else
On Error Resume Next
Forms(Me.Parent.Parent.name).Controls(Me.Parent.name). _
Form.Recordset.MoveNext
On Error GoTo Err_btnSeguinte_Click
End If
Exit_btnSeguinte_Click:
Exit Sub
Err_btnSeguinte_Click:
MsgBox Err.Description
Resume Exit_btnSeguinte_Click
End Sub
----------------------------
PS: adhIsSubForm is a function that checks if Internamentos is a subform or
a form
5) My error occurs here:
Forms(Me.Parent.Parent.name).Controls(Me.Parent.name). _
Form.Recordset.MoveNext
6) What's the problem?
TIA,
Vítor Barbosa
(Portugal) www.euro2004.com