Avatar of Peter Fors
Peter Fors
Flag for Sweden asked on

Ho do I check null value in a column of a ComboBox?

Hi
I have code that works well when Me.Kombinationsruta145.Column(8) contains a value.
But if the value in column (8) is Null, my If clause doesnt trap it.
The second part of the "If", after Else is always performed.

How can I stop the code and give the user a message when Me.Kombinationsruta145.Column(8) has a Null value?

I receive this error in line 190
Error 13 (Type mismatch) in procedure Kombinationsruta145_AfterUpdate,line 190

          Dim RecipeInChoosen As Long
          Dim RecipeInTank As Long

140       If (IsNull(Me.Kombinationsruta145.Column(8))) Then
              'Debug.Print Me.Kombinationsruta145.Column(8) & "column 8"
150           DoCmd.OpenForm "WarningOrNoteGeneric"
160           Forms!WarningOrNoteGeneric.TheMessage = "There is no recipe linked to this product in Article Index. Please close Filling Records and update Article index."
170           Exit Sub
180       Else
190           RecipeInChoosen = Me.Kombinationsruta145.Column(8)
200           RecipeInTank = Forms![bryggning tappning från lagertank]![Tappning Ingående batcher i en överföring underformulär].Form![recept]
              'Debug.Print RecipeInChoosen & "In choosen"
              'Debug.Print RecipeInTank & "In Tank"
210       End If

Open in new window

Best
Peter
Microsoft Access

Avatar of undefined
Last Comment
Peter Fors

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION 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
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Peter Fors

ASKER
Thank you very much Jim!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck