LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Grouping Event handlers

I have a data entry form with numerous fields. Certain fields are
required and need a non-blank input. I am trying to create a class
module for a text box where non-blank inputs are not allowed.

I have the following code:

Public WithEvents Required As MSForms.TextBox
Public notComplete As Integer


Private Sub Required_Change()
If (Required.Text < "") Then
notComplete = 0
Required.BackColor = &HFF&
Required.ForeColor = &H8000000E
Else
notComplete = 1
Required.BackColor = &HFF&
Required.ForeColor = &H8000000E
End If
MsgBox "In Event"
End Sub

Required is the text box object and notComplete is a flag that is 0 if
the text box has a value and 1 otherwise. The logic here is that all
"RequiredField" objects on a field should have the notComplete set to 0
for the entire form to be complete.

Once I have this code, written, as a test, I set one of my existing
text boxes to be an object of this type like so:

Dim req As RequiredField

Set req = New RequiredField
Set req.Required = frmDataEntry.txtClaimantName

However, when I run the form, changing txtClaimantName does not trigger
the event.

Is there something wrong with my process? Alternatively, is there a
better way to do this?

Any help is appreciated.


---
Message posted from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Event Steve Excel Discussion (Misc queries) 2 October 14th 08 11:04 PM
Problems with event handlers Italian Job Excel Programming 2 November 12th 03 01:26 AM
Do Event John Gittins Excel Programming 1 October 22nd 03 04:58 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"