Using IF statement for a subform

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
 
G

Guest

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


.
 
T

tina

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


.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top