ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MultiPage Form data not displaying when Value property changed (https://www.excelbanter.com/excel-programming/339066-multipage-form-data-not-displaying-when-value-property-changed.html)

Jim Zeeb[_2_]

MultiPage Form data not displaying when Value property changed
 
I have a form with a MultiPage control. When focus is changed to another
page, I want to make sure that data on the existing page has been updated by
the user. If they want to save their data, I want to keep them on the current
page so they can click the Update button.
I implemented this behavior by using the MultiPage.Click event. This event
receives control AFTER the new page receives focus. In the event procedure
if I detect that data has not been updated, I want to display the prior page.
I do this by setting MultiPage.value to the prior page index.
What is happening is when I set the Value property, that the correct Tab is
receiving focus, but the contents of the page do not change to that page's
controls. Very bizarre.

Any suggestions?
inTHANKSadvance

Gareth[_6_]

MultiPage Form data not displaying when Value property changed
 
Hi Jim,

I've been driven to distraction by this too. I couldn't find anything on
MS. However (see below links) it appears to be a bug in XL2003.

http://www.dicks-blog.com/archives/2...trols-on-2003/
http://www.excelforum.com/archive/in.../t-220362.html

Yup. It sucks. Maybe Tab Strips can suit your purpose - I don't know
about you though but I have a huge amount of code behind mine and just
hadn't put in the error trapping when changing pages bit until the end.

That said, I haven't tried the workaround mentioned in the first link
yet but anything using OnTime seems a little sketchy.

HTH,
Gareth


Jim Zeeb wrote:
I have a form with a MultiPage control. When focus is changed to another
page, I want to make sure that data on the existing page has been updated by
the user. If they want to save their data, I want to keep them on the current
page so they can click the Update button.
I implemented this behavior by using the MultiPage.Click event. This event
receives control AFTER the new page receives focus. In the event procedure
if I detect that data has not been updated, I want to display the prior page.
I do this by setting MultiPage.value to the prior page index.
What is happening is when I set the Value property, that the correct Tab is
receiving focus, but the contents of the page do not change to that page's
controls. Very bizarre.

Any suggestions?
inTHANKSadvance


Dave Peterson

MultiPage Form data not displaying when Value property changed
 
Maybe you can just keep those other pages disabled until all the information is
entered.

You could have each control call a separate subroutine to make sure there's
something in everything you want.

Difficult to describe since I don't know the controls you're using...

But I created a small userform with two pages.

On the first page, I put 2 textboxes and 2 optionbuttons.

I had this code behind the form:

Option Explicit
Private Sub OptionButton1_Click()
Call CheckControls
End Sub
Private Sub OptionButton2_Click()
Call CheckControls
End Sub
Private Sub TextBox1_Change()
Call CheckControls
End Sub
Private Sub TextBox2_Change()
Call CheckControls
End Sub
Private Sub CheckControls()

Dim okToContinue As Boolean

okToContinue = True

If Me.TextBox1.Value = "" Then
okToContinue = False
ElseIf Me.TextBox2.Value = "" Then
okToContinue = False
ElseIf (Me.OptionButton1.Value = False _
And Me.OptionButton2.Value = False) Then
okToContinue = False
End If

Me.MultiPage1.Pages(1).Enabled = okToContinue

End Sub
Private Sub UserForm_Initialize()
Me.MultiPage1.Pages(1).Enabled = False
End Sub

=======
An alternative would be to put all the validation into a button (kind of a Next
button) that would do the checking. If everthing was ok, it would either enable
the next page (or even make it visible!).

Kind of like one of those wizards you see (data|text to columns)



Jim Zeeb wrote:

I have a form with a MultiPage control. When focus is changed to another
page, I want to make sure that data on the existing page has been updated by
the user. If they want to save their data, I want to keep them on the current
page so they can click the Update button.
I implemented this behavior by using the MultiPage.Click event. This event
receives control AFTER the new page receives focus. In the event procedure
if I detect that data has not been updated, I want to display the prior page.
I do this by setting MultiPage.value to the prior page index.
What is happening is when I set the Value property, that the correct Tab is
receiving focus, but the contents of the page do not change to that page's
controls. Very bizarre.

Any suggestions?
inTHANKSadvance


--

Dave Peterson


All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com