Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Userform Answer Validation Problem

This works fine for me

Private Sub QC1Req_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim response
With Me
With QC1Req
If CDbl(.Text) < CDbl(QC1Done.Text) Then
response = MsgBox("Your 'Done value' is greater that your
'Required value.'")
Cancel = True
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End If
End With
End With

End Sub



--
HTH

Bob Phillips

"WillRn" wrote in message
...
Hello All,

I have a userform that tabulates the number of times a task was required
versus the number of times the task was actually done. A lot of my users

have
been transposing numbers so I thought I would validate that the required
value is equal or greater than the done value. So I wrote the following

line
of code and attached it to the Exit event for the field.

If QCMonitor.QC1Done.Value QCMonitor.QC1Req.Value Then
Response = MsgBox("Your 'Done value' is greater that your 'Required

value.'"
)Cancel = True
QCMonitor.QC1Req.SetFocus
End If

Problem is I can't get the cursor to go back to the Required field. I keep
getting a "Run-Time Error '-2147467259 (80004005)': Unspecified Error"

Any ideas on how to fix this?

Will



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Userform Answer Validation Problem

I tried this but still get the same error message. The problem seems to
revolve around the SetFocus.

Weird!

"Bob Phillips" wrote:

This works fine for me

Private Sub QC1Req_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim response
With Me
With QC1Req
If CDbl(.Text) < CDbl(QC1Done.Text) Then
response = MsgBox("Your 'Done value' is greater that your
'Required value.'")
Cancel = True
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End If
End With
End With

End Sub



--
HTH

Bob Phillips

"WillRn" wrote in message
...
Hello All,

I have a userform that tabulates the number of times a task was required
versus the number of times the task was actually done. A lot of my users

have
been transposing numbers so I thought I would validate that the required
value is equal or greater than the done value. So I wrote the following

line
of code and attached it to the Exit event for the field.

If QCMonitor.QC1Done.Value QCMonitor.QC1Req.Value Then
Response = MsgBox("Your 'Done value' is greater that your 'Required

value.'"
)Cancel = True
QCMonitor.QC1Req.SetFocus
End If

Problem is I can't get the cursor to go back to the Required field. I keep
getting a "Run-Time Error '-2147467259 (80004005)': Unspecified Error"

Any ideas on how to fix this?

Will




Reply
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
Must Answer Data Validation Question Wanna Learn Excel Discussion (Misc queries) 3 April 2nd 08 01:12 PM
Userform with validation... Mark \(InWales\)[_8_] Excel Programming 3 October 26th 04 07:20 AM
UserForm Date Validation Michael Vaughan Excel Programming 2 September 5th 04 08:45 PM
Userform Validation Todd Huttenstine[_2_] Excel Programming 2 December 13th 03 10:46 PM
Userform Date validation David Goodall Excel Programming 6 August 19th 03 11:46 PM


All times are GMT +1. The time now is 11:37 AM.

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

About Us

"It's about Microsoft Excel"