Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Form Validation in VB


EDIT: I've just typed this out and fixed the problem for myself. I knew
it was simple - the validate form needs to be called when the
"textbox1_change" & "textbox2_change" routines are run.

I thought I would post it anyway for any other newbies who want to make
a simple form validate - as I could'nt locate a similar post on the
forum.

Cheers

s

---------------

Hi all,

Sorry to post again - but once again I have hit a brick wall and can't
find the answers I need! :( Hopefully someone can help me -

I am trying to write a form validation, which disables a button unless
two text fields have information in them. I think the answer is
simple.

Here is my code so far -

-Private Sub Userform_Initialize()

CommandButton1.Enabled = False

TextBox1.Value = ""
TextBox2.Value = ""
With ComboBox1
..AddItem "Team 1"
..AddItem "Team 2"
..AddItem "Team 3"
..AddItem "Team 4"
End With

Call userform_validate

End Sub-


-Private Sub userform_validate()

CommandButton1.Enabled = False

If TextBox1.Value < "" And TextBox2.Value < "" Then
CommandButton1.Enabled = True

End If

End Sub-

As you guys can see by my code, I'm a complete noob! I think in theory
the code is ok - but from what I can see the problem is with where the
code is placed.

Thanks


--
systematic
------------------------------------------------------------------------
systematic's Profile: http://www.excelforum.com/member.php...o&userid=25294
View this thread: http://www.excelforum.com/showthread...hreadid=388330

Reply
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
Validation list in data entry form Steve M Excel Discussion (Misc queries) 4 May 5th 10 07:21 PM
Data validation causing problems when using a data form in Excel 2 Peter Excel Worksheet Functions 1 November 27th 09 12:00 AM
how do I add data validation dropdown lists to a Form SteveD.IFlora Excel Worksheet Functions 3 January 21st 05 04:48 PM
Web form validation using Excel datasource? arubyan Excel Programming 0 May 22nd 04 01:57 AM
Trapping and preventing a form from being e-mailed before validation quartz Excel Programming 1 April 27th 04 01:50 PM


All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"