Solved

Field = blank in Access form

Posted on 2011-02-21
5
342 Views
Last Modified: 2012-05-11
This should be so simple but yet I can't get an if then statement to work in vba for an access form. I created a button called "Correct" and when it is clicked I need code to run through the data in the split form to determine if it is correct or not. I don't have an issue if it is correct but when the field is blank the code automatically returns "incorrect" unless I write the code backwards. Like
If field1 <> "" then
field2 = "Incorrect"
else
field2 = "Correct"
end if

But I want to be able to also check numerous other answers in the field so I would like something like:

If field1 = "" or field1 = "12/31/2010" then
field2 = "Correct"
else
field2 = "Incorrect"
end if

Thank you
0
Comment
Question by:MRG_AL
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Runrigger
ID: 34946820
Your question isn't that clear.

Are you indicating that blank is correct sometimes?

What would be incorrect?
0
 

Author Comment

by:MRG_AL
ID: 34946951
I'm sorry. If it is blank I do want the connecting field to return "correct
This is my exact code for command "Correct"

Do While Me.MemberID <> ""
If Me.MemberID = "1411" Then
    If Me.HealthGuidance = "12/31/2010" Or Me.HealthGuidance = "" Then
        Me.NUM3 = "Correct"
    Else
        Me.NUM3 = "Incorrect"
    End If
End If
DoCmd.GoToRecord , , acNext
Loop
0
 
LVL 11

Accepted Solution

by:
Runrigger earned 500 total points
ID: 34947014
Have you tried

If IsNull() or IsEmpty() instead of =""
0
 

Author Closing Comment

by:MRG_AL
ID: 34947120
Thank you!!
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 34947129
You are welcome
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now