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: 18
Default CheckDate and return to usrfrm

I have a problem with a userform. This userform is shown when the user clicks
on a button in the excel spreadsheet. The user is then to enter some info in
various fields in the userForm. However when the user submits erronous info
the program gives a message in a message box to the user. when the user
clicks the ok button the user shall return to the userform (preferably
containing the same info as before). My problem is that I dont know how to
retun to the userform. In the code for Sheet1 I have:

Public Sub startKnapp_Click()
userForm1.Show
End Sub

when the user clicks the button the userform is shown and it is possible to
enter info. The check for error info (it works) is:

Private Sub checkDate()
If (Not (IsDate(userForm1.TextBox1.Text))) Then
MsgBox ("Error")
End If
If (Not (IsDate(userForm1.TextBox2.Text))) Then
MsgBox ("Error")
End If
End Sub

however this sub is called when the user has enterd info and THEN PRESSES AN
OK BUTTON. The code is:

Private Sub genereraRapportKnapp_Click()
Call checkDate
Call mainProgram
Unload Me
End Sub

How do I write the code so that the user returns to the form? I have tried
calling the sub that shows the userform but it does not work (the program
says that it is already shown..). If you know how to solve this problem or
avoid it please help me! Any assistance is of value! Someone said that you
could use the EXIT for the textboxes to check dateformat but this turns out
to quite messy in my case. What I want to do is to have the sub

genereraRapportKnapp_Click

and let this sub call another sub that returns a (boolean) value that says
if there are any problems. If there are then exit sub i.e. exit the
genereraRapportKnapp_Click

I think this will work but I do not know how to fix it. Please please help
me!!!

 
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
Return date if in range, else return blank LisaL Excel Worksheet Functions 1 July 22nd 09 03:23 PM
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null Ben Excel Discussion (Misc queries) 2 March 15th 07 01:02 AM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
check if reference exists, then return its value or return 0 doudou Excel Worksheet Functions 1 June 4th 05 09:17 PM
VBA Syntax for VLOOKUP to return array of return values Alan Beban[_3_] Excel Programming 7 August 5th 03 11:41 AM


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