BetaONE will rise again!


Reply
  #1  
Old 15th Jan 04, 09:08 PM
BlackMantis BlackMantis is offline
Senior Member
 
Join Date: Jul 2003
Posts: 111
BlackMantis
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
Reply With Quote
  #2  
Old 17th Jan 04, 07:02 AM
Gfields Gfields is offline
Junior Member
 
Join Date: Nov 2001
Posts: 24
Gfields
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
Reply With Quote
  #3  
Old 17th Jan 04, 07:27 PM
PCTech PCTech is offline
Senior Member
 
Join Date: May 2003
Location: USA
Posts: 362
PCTech is an unknown quantity at this point
Send a message via AIM to PCTech
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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:27 PM.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.