Null value to a variant - error

Ed S.

Board Regular
Joined
Mar 26, 2002
Messages
90
I am using a combo box to present a list of items in a form.

My intentions are to allow Blank input (not required entry), or data from the list. If data is not in list, default entry to blank or error message.

**************
I have tried using following events to replace data if null with a blank:

Private Sub ThisComBox77_BeforeUpdate(Cancel As Integer)
If IsNull(Me!FBTSC.Value) Then
Me![FBTSC.Value] = " "
End If
End Sub

Private Sub ThisComboBox_NotInList(NewData As String, Response As Integer)
If IsNull(Me!FBTSC.Value) Then
Me![FBTSC.Value] = " "
End If
End Sub
***********************

I continue to get tried to error " you tried to assign Null value to a variable that isn't a variant data type."

This data field comes from a linked query/table(AS400/DB2).

How do I handle null condition? (i am very new to MS Acess)
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
One thing I notice off-hand is that you're using the .value property for your form objects. I seem to remember this being a difference between VBA and straight-cold VB. Take out all of those .value's so that you just have:

Code:
Me!FBTSC
and see if that gets you any closer.
 
Upvote 0
But I don't quite understand why you don't just set the Required property to False in the underlying table? Will that not accomplish everything that you're trying to do?
 
Upvote 0

Forum statistics

Threads
1,221,527
Messages
6,160,342
Members
451,638
Latest member
MyFlower

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top