Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Error 3162 - null value / not a variant

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian - 10 Jun 2007 22:26 GMT
I have a misbehaving bound combo box on a form. The field to which it is
bound is neither required nor part of the primary key in the table, yet the
form generates a 3162 error ("You tried to assign the Null value to a
variable that is not a Variant data type") when I clear the value, whether
manually or programmatically.

Other reasons for 3162?

In addition, the PK of the table to which the form is bound consists of 4
fields. Curiously, I get the 3162 when deleting the value from any of the
three non-date controls, but not when I clear the value of the one
date-formatted control/field that is part of the PK.
Brian - 10 Jun 2007 22:40 GMT
Well, I figured out the problem. The RecordSource of the form includes
(equal) joins to other tables on the fields in quesion (for record-sorting
purposes).

Since my concern regarding the Null values in the first place was only that
I needed to provide a way to handle the Nulls, that just becomes one job I do
not need to do for those controls on this form.

> I have a misbehaving bound combo box on a form. The field to which it is
> bound is neither required nor part of the primary key in the table, yet the
[quoted text clipped - 8 lines]
> three non-date controls, but not when I clear the value of the one
> date-formatted control/field that is part of the PK.
Douglas J. Steele - 10 Jun 2007 22:43 GMT
It sounds as though somewhere in code, you're assigning the value of the
control to a variable.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I have a misbehaving bound combo box on a form. The field to which it is
> bound is neither required nor part of the primary key in the table, yet
[quoted text clipped - 9 lines]
> three non-date controls, but not when I clear the value of the one
> date-formatted control/field that is part of the PK.
Brian - 11 Jun 2007 00:48 GMT
Thanks, Douglas. That was my first thought, but look at my 2nd post. I had
the form's record source joined to another table so I could sort on fields
from the joined tables.

I removed the join temporarily and poof - problem gone. While I would still
have liked the ability to re-nullify that field, I understand the logic
inherent in the equal join, and in the end, all I was trying to do was to
handle nulls in the control's before/after update. Since there cannot be any
nulls as the result of an update in this case, it's just less code I have to
write.

> It sounds as though somewhere in code, you're assigning the value of the
> control to a variable.
[quoted text clipped - 12 lines]
> > three non-date controls, but not when I clear the value of the one
> > date-formatted control/field that is part of the PK.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.