Solved

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

Posted on 2016-11-18
6
68 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
[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
6 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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
Technology Partners: 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!

 
LVL 21
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 21
ID: 41893871
you're welcome, Dustin ~ happy to help
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 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