Using IF statement for a subform

  • Thread starter Thread starter Raymond Clarke
  • Start date Start date
R

Raymond Clarke

Can someone please assist me with the following. I want
to check a textbox to see if it is null, if so, close the
form. If the textbox is filled, I want to call a sub.

This is not working. Please HELP! Thank you.

Private Sub cmdClose_Click()
If PolicyData![QCCorrect].Value = True Then
DoCmd.Close
Else
Call Verify
End If
End Sub
 
Thank you for you help, but it is not working. I added
this code but is does nothing. Am I missing something?

If IsNull(PolicyData![QCCorrect]) Then
DoCmd.Close
End If
-----Original Message-----
Hi,

Try using IsNull() :
If IsNull(PolicyData![QCCorrect]) Then

Or test for empty string as well:
If Len(PolicyData![QCCorrect] & "") > 0 Then

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/






Can someone please assist me with the following. I want
to check a textbox to see if it is null, if so, close the
form. If the textbox is filled, I want to call a sub.

This is not working. Please HELP! Thank you.

Private Sub cmdClose_Click()
If PolicyData![QCCorrect].Value = True Then
DoCmd.Close
Else
Call Verify
End If
End Sub


.
 
use your original code, just replace your test expression
with the one Mark gave you, as

Private Sub cmdClose_Click()
If IsNull(PolicyData![QCCorrect]) Then
DoCmd.Close
Else
Call Verify
End If
End Sub

hope this works for you; if not, next question is: is the
form control a textbox or a checkbox?


-----Original Message-----
Thank you for you help, but it is not working. I added
this code but is does nothing. Am I missing something?

If IsNull(PolicyData![QCCorrect]) Then
DoCmd.Close
End If
-----Original Message-----
Hi,

Try using IsNull() :
If IsNull(PolicyData![QCCorrect]) Then

Or test for empty string as well:
If Len(PolicyData![QCCorrect] & "") > 0 Then

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/






Can someone please assist me with the following. I want
to check a textbox to see if it is null, if so, close the
form. If the textbox is filled, I want to call a sub.

This is not working. Please HELP! Thank you.

Private Sub cmdClose_Click()
If PolicyData![QCCorrect].Value = True Then
DoCmd.Close
Else
Call Verify
End If
End Sub


.
.
 
Back
Top