Solved

MS Access IsNull Then Compile Error Expected Then or goto WHY?????

Posted on 2016-11-18
6
15 Views
Last Modified: 2016-11-18
Why is this not working???

Private Sub btnPrintLabels_Click()
    If Me.SkuNm.value isNull Then
      msgbox "Please Fill Out Name Title First.", vbInformation, "Message"
       SkuNm.SetFocus
    Exit Sub
   Else
     PrintLabel
      Forms!frmSkusEntry!PrintLabelQTY.value = "1"
    End If
End Sub

Open in new window

0
Comment
Question by:Dustin Stanley
  • 3
  • 2
6 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 41893858
try this
Private Sub btnPrintLabels_Click()
    If  isNull(Me.SkuNm) Then
      msgbox "Please Fill Out Name Title First.", vbInformation, "Message"
       SkuNm.SetFocus
    Exit Sub
   Else
     PrintLabel
      Forms!frmSkusEntry!PrintLabelQTY.value = "1"
    End If
End Sub

Open in new window


this is my  preference

Private Sub btnPrintLabels_Click()
    If Me.SkuNm & ""="" Then
      msgbox "Please Fill Out Name Title First.", vbInformation, "Message"
       SkuNm.SetFocus
    Exit Sub
   Else
     PrintLabel
      Forms!frmSkusEntry!PrintLabelQTY.value = "1"
    End If
End Sub

Open in new window

0
 

Author Comment

by:Dustin Stanley
ID: 41893859
LOL I forgot the Parenthesis. I can't believe that! Thanks Rey! I like the other way also but couldn't think of it.
0
 

Author Closing Comment

by:Dustin Stanley
ID: 41893860
Thanks!
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 18
ID: 41893862
IsNull, one word is a function that then expects an argument  to test. Use
If isNull (Me.SkuNm.value) Then

Open in new window

Is Null, two words, is used to compare an object to Null.  You will find this used in SQL generated for queries.
0
 

Author Comment

by:Dustin Stanley
ID: 41893866
Thanks Crystal that will broaden my knowledge so when I see it I won't be confused. :)
0
 
LVL 18
ID: 41893871
you're welcome, Dustin ~ happy to help
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 …

757 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