473,465 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access DB error message when using ASP.NET 2.0

Hi

I was wondering if anyone could help me with this problem. I've been using
VWD and my webhost ( a shared hosting package) have told me that the MSQL
express files wont work on thier server so I've tried switching to Access
and I cant add or delete new records either locally or on thier server.

I keep getting this error message.

"You tried to assign the Null value to a variable that is not a Variant data
type"

I've had a look at folder permissions and field data types.

Any help would be welcome.

Regards
--
Richard Finnigan
Work Website http://www.ict-action.com
Homepage http://www.richardsthings.co.uk
Hobby Webpage http://www.closeimage.co.uk
Jul 30 '06 #1
3 2406
Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant type).

An easy way to fix that is to use the text box's BeforeUpdate event to check for data.

Private Sub txtName_BeforeUpdate(Cancel As Integer)

If IsNull(Me.txtName) Then
' display an alert telling the user that some data is needed for the field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions fixed your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Richard Finnigan" <di*******@btopenworld.comwrote in message
news:yb********************@bt.com...
Hi

I was wondering if anyone could help me with this problem. I've been using VWD and my webhost ( a
shared hosting package) have told me that the MSQL express files wont work on thier server so I've
tried switching to Access and I cant add or delete new records either locally or on thier server.

I keep getting this error message.

"You tried to assign the Null value to a variable that is not a Variant data type"

I've had a look at folder permissions and field data types.

Any help would be welcome.

Regards
--
Richard Finnigan
Work Website http://www.ict-action.com
Homepage http://www.richardsthings.co.uk
Hobby Webpage http://www.closeimage.co.uk


Jul 30 '06 #2

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant
type).

An easy way to fix that is to use the text box's BeforeUpdate event to
check for data.

Private Sub txtName_BeforeUpdate(Cancel As Integer)

If IsNull(Me.txtName) Then
' display an alert telling the user that some data is needed for the
field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions
fixed your problem.

Hi Julian

Thanks for your help with this problem, It was the second issue and
removing references to the ID field fixed it.

I've now hit the folder permissions issue on the remote website :(

Hayho.

Richard Finnigan
Jul 31 '06 #3
re:
Thanks for your help with this problem,
You're quite welcome, Richard.

re:
It was the second issue and removing references to the ID field fixed it.
It's good to know that you're up and running again!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Richard Finnigan" <di*******@btopenworld.comwrote in message
news:o8******************************@bt.com...
>
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
>Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant type).

An easy way to fix that is to use the text box's BeforeUpdate event to check for data.

Private Sub txtName_BeforeUpdate(Cancel As Integer)

If IsNull(Me.txtName) Then
' display an alert telling the user that some data is needed for the field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions fixed your problem.

Hi Julian

Thanks for your help with this problem, It was the second issue and removing references to the ID
field fixed it.

I've now hit the folder permissions issue on the remote website :(

Hayho.

Richard Finnigan

Jul 31 '06 #4

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

Similar topics

1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
10
by: Shawn | last post by:
JIT Debugging failed with the following error: Access is denied. JIT Debugging was initiated by the following account 'PLISKEN\ASPNET' I get this messag in a dialog window when I try to open an...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.