Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling | Excel Discussion (Misc queries) | |||
Handling #NUM! error | Excel Worksheet Functions | |||
Error handling | Excel Programming | |||
Error Handling | Excel Programming | |||
Error Handling | Excel Programming |