Solved

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

Posted on 2016-11-18
6
42 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 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 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