LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error Handling Routine


It sounds as though you are exiting regardless of the msgbox answer, but I
think it would help to see all the code to see how and why.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"kenrmcl " wrote in message
...
G'day there One & All,

I have a Userform in a project I'm working on that contains 3 text
boxes whose contents are fields in a record to add to a list. It works
just fine except for one annoying problem. I have an error checking
function that I call when a button is clicked on the form. This checks
for a blank entry (all 3 text boxes must have an entry), and correct
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, it
disappears and so does the userform. I'd like the userform to remain so
that the user can correct the fault condition.

I have the userform built in the VBE, I don't construct it
programmatically. The code for the UserForm "Enter" button runs
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 think
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 appropriate
MsgBox (I've got that bit working OK), but on clicking the "OK" button
it clears the MsgBox, the UserForm, and then stores the dud record
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 McLennan


---
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 05:22 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"