[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2016-11-18
6
Medium Priority
?
116 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…
Suggested Courses
Course of the Month18 days, 21 hours left to enroll

834 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