-
Help, I help with my form!!!!!!!!!!
[Originally posted by Kristine Wilton]
I need to disable my print button, until calculation is complete, and disable calulation button untilall fields are entered˙ Any help could be greatly appreciated
-
Re:Help, I help with my form!!!!!!!!!!
[Originally posted by Marc Cramer]
Hello...
you could try
if field.text<>"" then calculate.enabled=true
and for the calculation...
sub CalculateMe()
do some stuff
print.enabled=true
end sub
-
Re:Help, I help with my form!!!!!!!!!!
[Originally posted by Sanjaya]
HI!
˙ I had provide this help with thinking you're using textboxes for your fields.
Create a subroutine for validation, like this
Private Sub Validation()
For Each ctrlControl In Form1.Controls
˙ ˙ 'Check text boxes
˙ ˙ If TypeOf ctrlControl Is TextBox Then
˙ ˙ ˙ ˙ ˙ 'Check for empty textboxes
˙ ˙ ˙ ˙ ˙ If ctrlControl.Text = vbNullString Then
˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = False
˙ ˙ ˙ ˙ ˙ Else
˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = True
˙ ˙ ˙ ˙ ˙ End If
˙ ˙ End If
Next
End Sub
After that you have to call that sub in each textbox's change event. Just type
Validation
only.
-
Re:Help, I help with my form!!!!!!!!!!
[Originally posted by Sanjaya]
HI!
˙ I had provide this help with thinking you're using textboxes for your fields.
Create a subroutine for validation, like this
Private Sub Validation()
For Each ctrlControl In Form1.Controls
˙ ˙ 'Check text boxes
˙ ˙ If TypeOf ctrlControl Is TextBox Then
˙ ˙ ˙ ˙ ˙ 'Check for empty textboxes
˙ ˙ ˙ ˙ ˙ If ctrlControl.Text = vbNullString Then
˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = False
˙ ˙ ˙ ˙ ˙ Else
˙ ˙ ˙ ˙ ˙ ˙ ˙ cmdPrint.Enabled = True
˙ ˙ ˙ ˙ ˙ End If
˙ ˙ End If
Next
End Sub
After that you have to call that sub in each textbox's change event. Just type
Validation
only.
-
Re:Help, I help with my form!!!!!!!!!!
[Originally posted by Ed Ardzinski]
Some good ideas...When I need fields to be filled out completely before performing an operation I usually do a "Brute Force" type of validation...I define an integer variable (I usually call it 'intErr'), and create If blocks to deal with checking the required fields.
Usually they look sort of like this:
If (Text1 = "")Then
intErr = MsgBox("Text1 needs data!", vbExclamation + vbOKOnly, "Doh!!!")
Text1.SetFocus
Exit Sub
End If
Put a series of these before the code that performs your calculation, and if any of the criteria are not me, the sub will exit before the calculation, and focus will be placed to the field that has the problem.
Often I can group several of these routines together into a sub in the class module; at the very most I have a little editing to do after a copy/paste.˙ This approach has generally worked very well for me...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks