Detecting Page Change in MultiPage

  • Thread starter Thread starter Ripan
  • Start date Start date
R

Ripan

What event triggers a change of page in a multievent. I am designing
multipage data entry form. Each page has a count of the number of dat
entry errors. I want to be able to prevent switching to another page i
there are errors on the existing page. How can I capture the movemen
to another page?

I would ideally check the error count during that event and ac
accordingly.

Any help is appreciated
 
There's a multipage_change event that you can tie into.

Option Explicit
Dim CurPage As Long
Dim blkProc As Boolean
Dim DataEntryErrors(0 To 3) As Long

Private Sub MultiPage1_Change()

If blkProc = True Then Exit Sub

With Me.MultiPage1(CurPage)
If DataEntryErrors(CurPage) > 0 Then 'how do you determine this???
'some error
blkProc = True
Me.MultiPage1.Value = CurPage
blkProc = False
Else
CurPage = Me.MultiPage1.Value
End If
End With


End Sub

Private Sub UserForm_Initialize()

'some error data!
DataEntryErrors(0) = 0
DataEntryErrors(1) = 1
DataEntryErrors(2) = 0
DataEntryErrors(3) = 0

CurPage = Me.MultiPage1.Value

End Sub

In my simple test, I put 4 pages (0-3) on a form. As soon as I clicked on the
second one, I was stuck. I didn't include a way of clearing the error.

And this may not apply, but from a user standpoint, on a lot of forms, I like to
look between the pages to see what I already entered so that I know what to do
next. This would stop me until I cleared the errors.

You may want to consider validating everything at one time--or maybe not...
 
Back
Top