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