N
nerb61 via AccessMonster.com
Follow-up to earlier question from a couple of weeks ago. I thought I had it
working, but I ran into a problem. I have Navigation buttons on a subform
that navigate through a series of questions. Code below. The problem is when
the user goes to the navigation buttons on the main form moving to the next
issues which takes them through another set of questions - the subform
navigation buttons get crazy. The questions don't start with number one and
you can't always go Next and Previous without a Can't go to specified record
error. Any ideas???
Sub SetNavButtons(SomeForm As Form)
On Error GoTo SetNavButtons_Error
With SomeForm
If .CurrentRecord = 1 Then
.cmdNextKeyDecision.SetFocus
.cmdPrevKeyDecision.Enabled = False
ElseIf .CurrentRecord = .Recordset.RecordCount Then
.cmdPrevKeyDecision.Enabled = True
.cmdPrevKeyDecision.SetFocus
.cmdNextKeyDecision.Enabled = False
Else
.cmdPrevKeyDecision.Enabled = True
.cmdNextKeyDecision.Enabled = True
End If
End With
SetNavButtons_Exit:
On Error Resume Next
Exit Sub
SetNavButtons_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure SetNavButtons of Module modFormOperations"
GoTo SetNavButtons_Exit
End Sub
working, but I ran into a problem. I have Navigation buttons on a subform
that navigate through a series of questions. Code below. The problem is when
the user goes to the navigation buttons on the main form moving to the next
issues which takes them through another set of questions - the subform
navigation buttons get crazy. The questions don't start with number one and
you can't always go Next and Previous without a Can't go to specified record
error. Any ideas???
Sub SetNavButtons(SomeForm As Form)
On Error GoTo SetNavButtons_Error
With SomeForm
If .CurrentRecord = 1 Then
.cmdNextKeyDecision.SetFocus
.cmdPrevKeyDecision.Enabled = False
ElseIf .CurrentRecord = .Recordset.RecordCount Then
.cmdPrevKeyDecision.Enabled = True
.cmdPrevKeyDecision.SetFocus
.cmdNextKeyDecision.Enabled = False
Else
.cmdPrevKeyDecision.Enabled = True
.cmdNextKeyDecision.Enabled = True
End If
End With
SetNavButtons_Exit:
On Error Resume Next
Exit Sub
SetNavButtons_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure SetNavButtons of Module modFormOperations"
GoTo SetNavButtons_Exit
End Sub