Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
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 |