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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

debug issue 1

Status
Not open for further replies.

kpryan

Technical User
Aug 24, 2005
282
US
Hi all
On a form I have a field that has to have data in it before opening another form which uses data from this form. If the data is missing a debug sign shows... "invalid use of null"
While I have a default value to stop this sometimes staff will remove this.
How can I stop this sign from appearing?

Many thanks

Ken
 
Im guessing this message appears when you press the command button? if it is a required field then put the following on your onclick event of the command button.

If IsNull(TEXTBOX NAME) Then
MsgBox ("You must enter a value for TEXTBOX NAME")
Me!TEXTBOX NAME.SetFocus

That way the user cant leave the field blank.

Hope that helps,
Nim
 
Hi nim180,
many thanks for your reply,
Yes this does work, but when you go to close the message box down to enter the data it shows the debug again.

Ken
 
kpryan . . .

Post the code in the button . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi kpryan,

put the code at the top of the onclick event of the button before any other code. try this.

If IsNull(TEXTBOX NAME) Then
MsgBox ("You must enter a value for TEXTBOX NAME")
Me!TEXTBOX NAME.SetFocus

else

'rest of code'

end if (at the bottom just above "end sub")

nim
 
Hi nim180
Many thanks,

It works great. Putting it at the top of the other code.

Many thanks,

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top