[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Field = blank in Access form

Posted on 2011-02-21
5
Medium Priority
?
350 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

649 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