Saving 'Null' Fields

redm

Member
Joined
Sep 20, 2005
Messages
8
Programming Experience
Beginner
I am working with an Access database, and when I save a blank or null value to a memo field it gives an error. I had a similar problem with saving to a text field, however I was able to resolve that by changing the 'Allow Zero Length' field in access to 'Yes'. The same does not fix the memo field problem, but changing the memo field to a text field will allow the program to save the 'null' value.

Below is my code. The message I get (when the field is a memo field) is
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll"

Dim cb As New OleDb.OleDbCommandBuilder(DB.da_Assets)

DB.ds_Assets.Tables("assets_Data").Rows(inc_Assets).Item(0) = cboAssetName.Text
DB.ds_Assets.Tables("assets_Data").Rows(inc_Assets).Item(1) = cboAssetType.Text
DB.ds_Assets.Tables("assets_Data").Rows(inc_Assets).Item(8) = txtAssetNotes.Text

DB.da_Assets.Update(DB.ds_Assets, "assets_Data")

any ideas
 
I dont't think yuor the first person the encounter this problem and i don't currently know of anyway to workaround this problem, atleast no easy way. But a couple of things that i know of are:-

Convert the database to MySql - Probably undesireable.
Leave out the Memo Field and use a text field but also add another 'Line Number' field so if the amount of characters goes above 255 it will create a new line number and you can write a routine to join them together when you retrieve the information.

I know thats probably not too helpful, but hey i tried.:)
 
Back
Top