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 Error Handling Routine

G'day there One & All,

I have a Userform in a project I'm working on that contains 3 tex
boxes whose contents are fields in a record to add to a list. It work
just fine except for one annoying problem. I have an error checkin
function that I call when a button is clicked on the form. This check
for a blank entry (all 3 text boxes must have an entry), and correc
formatting of the first text box which must be either 4 or 5 digits.

If these conditions aren't met then a MsgBox alerts the user
That's where my problem begins. When the user clicks the MsgBox, i
disappears and so does the userform. I'd like the userform to remain s
that the user can correct the fault condition.

I have the userform built in the VBE, I don't construct i
programmatically. The code for the UserForm "Enter" button run
thusly:

Private Sub CommandButton1_Click()

Set up variables
Run some stuff

test = CheckOfficer(offNum.Text, offName.Text, offRank.Text)
If test = False Then
End If

(I've not yet got anything between "Then" & "end If". I thin
that's probably what I'm asking for)

Run more stuff

End Sub

I've got the errorchecking bit to return "False" if there's an error
and "True" if not. If there is an error then it shows the appropriat
MsgBox (I've got that bit working OK), but on clicking the "OK" butto
it clears the MsgBox, the UserForm, and then stores the dud recor
anyway.

How can I get it to leave the Userform up for correction?

I'll be happy to post the full code if need be.

See ya
and Thanks
Ken McLenna

--
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
Error Handling Kevin Excel Discussion (Misc queries) 4 June 19th 08 12:31 AM
Handling #NUM! error Michel Khennafi Excel Worksheet Functions 1 February 26th 07 08:49 PM
Error handling John Pierce Excel Programming 3 October 3rd 03 12:17 PM
Error Handling Rob Bovey Excel Programming 0 August 7th 03 12:11 AM
Error Handling Bill Lunney Excel Programming 0 August 6th 03 11:56 PM


All times are GMT +1. The time now is 09:49 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"