isnull on a fieldname

  • Thread starter Thread starter mark r
  • Start date Start date
M

mark r

Part one of the question:
For a commandbutton:

If ( A ) then msgbox


where A is a textfield with digits in it
I want the msgbox to display if the textfield is empty (no
digits)

ISNULL is for variables........if I do
ISNULL(textfieldname) it doesn't work.


how do I check if a textfield is empty or not?
 
Try:
If IsNull(Me.[A]) Then

That should work unless you are assigning a zero length string to the text
box. If you need to test for that as well:
If Len(Nz(Me.[A], "") = 0 Then
 
Can I substitute ME.[A] for otherEmbeddedSubFormName![A]?

As an aside, When running a query against this underlying
table, a msgbox prompts me for a date to match against
date/time field Date_of_interest because I have a Where
clause: Where Date_of_interest = checkdate

Date_of_interest is a date format 11/12/2002 but when I
put that date into the msgbox for checkdate, I get no
results.





-----Original Message-----
Try:
If IsNull(Me.[A]) Then

That should work unless you are assigning a zero length string to the text
box. If you need to test for that as well:
If Len(Nz(Me.[A], "") = 0 Then

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Part one of the question:
For a commandbutton:

If ( A ) then msgbox


where A is a textfield with digits in it
I want the msgbox to display if the textfield is empty (no
digits)

ISNULL is for variables........if I do
ISNULL(textfieldname) it doesn't work.


how do I check if a textfield is empty or not?


.
 
In the code module of the main form, to test the value of text box "A" in
subform "otherEmbeddedSubFormName", use:
If IsNull(Me.otherEmbeddedSubFormName.Form.A) Then

In the context of a query, use:
[Forms]![NameOfMainFormHere]![otherEmbeddedSubFormName].[Form]![A]

I'm not sure whether you intend 11/12/2002 to be Nov 12 (like the Americans)
or 11 Dec (like the British), and Access may not understand what you intend
either. To avoid the ambiguity, see:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

mark r said:
Can I substitute ME.[A] for otherEmbeddedSubFormName![A]?

As an aside, When running a query against this underlying
table, a msgbox prompts me for a date to match against
date/time field Date_of_interest because I have a Where
clause: Where Date_of_interest = checkdate

Date_of_interest is a date format 11/12/2002 but when I
put that date into the msgbox for checkdate, I get no
results.





-----Original Message-----
Try:
If IsNull(Me.[A]) Then

That should work unless you are assigning a zero length string to the text
box. If you need to test for that as well:
If Len(Nz(Me.[A], "") = 0 Then


Part one of the question:
For a commandbutton:

If ( A ) then msgbox


where A is a textfield with digits in it
I want the msgbox to display if the textfield is empty (no
digits)

ISNULL is for variables........if I do
ISNULL(textfieldname) it doesn't work.


how do I check if a textfield is empty or not?
 
Back
Top