Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'd like a button to be "pushable" when all fields are completed

Status
Not open for further replies.

Ju

Technical User
Jul 4, 2000
61
FR
I'd like that when all the entries of a field are filled a button gets pushable or it gives me back a message.<br><br>Thank you.
 
You can write a sub that gets called from the AfterUpdate event of each of the fields that you're checking.&nbsp;&nbsp;The sub should check if each of the relevant fields has a valid value.&nbsp;&nbsp;If a field is text, you could check that length of the field is greater than 0; if the field is numeric, you could check that it's not null. If each field has a value, the sub should either print a message to the user or set the Enabled property of your button to true. <br><br>Private Sub CheckWhetherDone()<br>' This assumes Field1 is text and Field2 is numeric.<br>' The following If statement should check all of the relevant fields.&nbsp;&nbsp;Include them instead of the ...<br>&nbsp;&nbsp;If (len(Field1)&gt;0) and (not isnull(Field2)) and&nbsp;&nbsp;... then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;All fields have been filled&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OR<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me!Button.Enabled = true<br>&nbsp;&nbsp;End If<br>End Sub<br><br>Private Sub Field1_AfterUpdate()<br>&nbsp;&nbsp;&nbsp;CheckWhetherDone<br>End Sub<br><br>
 
I have as button an image called Image10. I replaced the Me!Button.Enabled=true with Me!Image10.Enabled=true and it doesn't work right.<br>&nbsp;<br>Thank you.
 
Are you sure you are working with a button?&nbsp;&nbsp;What does it say at the top of the propertysheet?&nbsp;&nbsp;It should say &quot;Command Button: &quot; followed by the name of your command button.<br><br>Please be more specific in future about what isn't working.&nbsp;&nbsp;What is not happening that should be or what is happening that shouldn't be?
 
Ok,<br>my huge trouble was that I wasn't using a button...oops &gt;;)<br>Now it looks like it's ok.<br>Thanks for your help.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top