473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem Setting A Field To Null

AssignedEquipmentType and AssignedEquipment are text data type. Both are unique
five character codes. I have both fields in a continuous form. The database
requires that if an Equipment type is entered, an equipment item must also be
entered. I have the following code' to handle the case if AssignedEquipmentType
has been highlighted and deleted that AssignementEquipment must be set to Null.
When the code runs, I get error 3162 - You tried to assign the Null value to a
variable that isn't a Variant data type. Can someone help me to resolve the
problem.

Private Sub AssignedEquipmentType_AfterUpdate()
On Error GoTo ErrorHandler
If IsNull(Me!AssignedEquipmentType) Then
Me!AssignedEquipment = Null
Me!AssignedEquipmentType.SetFocus
Exit Sub
End If
End Sub

Thanks for your help!

Corrine
Nov 13 '05 #1
1 4047
The error message suggests that Access is confused about what
"AssignmentEquipment" refers to. Do you have a field by this name? A text
box? Something else as well (e.g. a variable, or label, or ...)?

You could try something like this:

Private Sub AssignedEquipmentType_AfterUpdate()
If IsNull(Me!AssignedEquipmentType) And Not IsNull(Me.AssignedEquipment)
Then
Me!AssignedEquipment = Null
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Corrine" <cm****@earthlink.net> wrote in message
news:5n****************@newsread2.news.atl.earthli nk.net...
AssignedEquipmentType and AssignedEquipment are text data type. Both are unique five character codes. I have both fields in a continuous form. The database requires that if an Equipment type is entered, an equipment item must also be entered. I have the following code' to handle the case if AssignedEquipmentType has been highlighted and deleted that AssignementEquipment must be set to Null. When the code runs, I get error 3162 - You tried to assign the Null value to a variable that isn't a Variant data type. Can someone help me to resolve the problem.

Private Sub AssignedEquipmentType_AfterUpdate()
On Error GoTo ErrorHandler
If IsNull(Me!AssignedEquipmentType) Then
Me!AssignedEquipment = Null
Me!AssignedEquipmentType.SetFocus
Exit Sub
End If
End Sub

Thanks for your help!

Corrine

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Roger Withnell | last post by:
I'm updating a record by opening a recordset, setting the fields and the updating it with objRS.Update. I need to set an image datatype to NULL. objRS("field") = NULL works for datatypes int...
2
by: WhiskyRomeo | last post by:
I have a bound textbox (bindings are set at design time) to a dataset column. Sometimes the value of this textbox must be set so that the underlying database field gets updated to null when using...
3
by: Mark | last post by:
Hi all, i'm trying to serialize a class. Using the constructor of XmlSerializer i get these (odd?) errors: "File or assembly name goseij9w.dll, or one of its dependencies, was not found"....
2
by: David W. Fenton | last post by:
I was on a deadline yesterday with a report created in Access 2000. I was adding a PastDue amount to an Invoice record and needed to alter the Invoice report to have a PastDue field. I wanted the...
7
by: Filips Benoit | last post by:
Hi, TBL_CONTACT_PERSON CNTP_ID (auto) CNTP_LAST_NAME (required = yes) CNTP_FUNCTION (required = no) CNTP_..... (all required = no) FRM_CONTACT_PERSON_ADD_NEW Property DATA ENTRY = YES
8
by: Rebecca | last post by:
We are converting my Access97 back end to SQL Server and almost have it all working. The current problem has to do with one situation in which I have to programmatically (still in the Access97...
2
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold...
10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
4
by: Nicolas | last post by:
The lat part is not working why ???????? Please help......... using System; namespace ConsoleApplication4 {
2
by: clickon | last post by:
I am using ASP.net 2.0 and trying to take advantage of the updated data editing facilities provided through the SQLDataSource control and the DetailsView control. The data is a record from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.