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

Verify Null value in text box 1

Status
Not open for further replies.

Mantle51

Programmer
Joined
Aug 17, 2006
Messages
97
Location
US
Hello,

Being an Excel guy by nature, I'm trying to find something equivalent to [activecell.value=""] within the code of an Access form. The code to run after an 'on click' event needs to verify if any value exists in a particular text box. So I try something like this:

If Access.acTextBox"Account No".Value = Null Then
msgbox...

Any help would be greatly appreciated.

RO
 



Hi,

NULL has a special meaning that is NOT the same as "". You want "".

Check out HELP.

Skip,

[glasses] [red][/red]
[tongue]
 
I understand that, but I need to know the Access syntax for referencing a named textbox similar to <<Sheets("123").select>> in excel
 
Hello,

as Skip said, NULL is not the same as "" but you can (and probably will want) to verify if your field is not null.

many ways to do this I guess
I use
Code:
vartype(me.txtTextBox) <> vbNull

for the "" use the sample code you sent with the ""

Good luck


SG
 
Another example...

If isnull(me.txtbox) = true then
msgbox "Text box contains a null"
end if

OR

If nz(me.txtbox,"") = "" then
msgbox "Nothing in your next box"
end if


Gary
gwinn7
 
How are ya Mantle51 . . .

In a nut shell:
Code:
[blue]   If Trim(Me![purple][b]TextboxName[/b][/purple] & "") = "" Then
      'Your MsgBox here
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top