Avatar of Dustin Stanley
Dustin Stanley

asked on 

Access VBA How To Check a Table To See If The Field Value Is Null

I have a form and in that form I have a textbox after I update the value in the unbound textbox I want to check a table to see if the field value is Null

Form is called frmHomePage

Textbox is called SKU

Table I am checking is called SKUs and the field is called SkuLength

I am checking on [SKUs].[SKU] = [Forms]![frmHomePage]![SKU]

So far the code I have is this but it is not working:

Dim SKUid As String

SKUid = [Forms]![frmHomePage]![SKU]

If DCount(1, "SKUS", "IsNull([SkuLength] WHERE [SKUs].[SKU] = SKUid)") > 0 Then
MsgBox "Has nulls"
Else
MsgBox "Complete!"
End If

Open in new window


Thanks for the help.
Microsoft AccessVBA

Avatar of undefined
Last Comment
Dustin Stanley
SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
IF DCount("*", "SKUS", "[SKUs].[SKU] = " & SKUid & " AND ISNULL("[SkuLength])")

This assumes that SKUId is a number

Kelvin
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Dustin Stanley
Dustin Stanley

ASKER

Thank you for the help. I am trying them now and altering them some to see if I can get them to work. SKUid is actually a string not a number.
IF DCount("*", "SKUS", "[SKUs].[SKU] = '" & [Forms]![frmHomePage]![SKU] & "' AND ISNULL("[SkuLength])")

Should handle the string


Kelvin
Avatar of Dustin Stanley

ASKER

I got it thanks!
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo