BetaONE will rise again!

BetaONE will rise again! (http:\\b1.hcanet.com\forum/index.php)
-   Software Support (http:\\b1.hcanet.com\forum/forumdisplay.php?f=45)
-   -   Help! Validate A Textbox? :huh: (http:\\b1.hcanet.com\forum/showthread.php?t=10382)

BlackMantis 15th Jan 04 09:08 PM

Hey B1,

I ran into a little bump in the road. I am implementing a form in access.. Basically, I have a print button on the form as well as a text box. what I want to do is to send an error message when I click print if the text box is empty and cancel the print job. this will ensure I have a value in the text box. Can someone assist me in this code for the print button?

Thanks ;)

Gfields 17th Jan 04 07:02 AM

You could try this. Don't forget to change the relevant bits


Quote:


Private Sub CommandButton1_Click()
&nbsp; &nbsp; If TextBox1.Text <> "" Then
&nbsp; &nbsp; &nbsp; &nbsp; DoYourPrintThing
&nbsp; &nbsp; Else
&nbsp; &nbsp; &nbsp; &nbsp; msg = MsgBox("You need something in the textbox", vbCritical + vbOKOnly, "Warning")
&nbsp; &nbsp; End If
End Sub


PCTech 17th Jan 04 07:27 PM

i've always used this in visual basic

Code:

...
if trim(textbox1.text) = "" then
 &nbsp; &nbsp; msgbox "you need to enter something in the textbox!"
else
 &nbsp; &nbsp; doprintfunction() '/ your print function code here
end if
...

Similar to the above, but its just what i've always used


All times are GMT +1. The time now is 01:42 AM.

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.