?
Solved

Field = blank in Access form

Posted on 2011-02-21
5
Medium Priority
?
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

762 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