Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Add an empty string to a field

 
   Database Help (Home) -> Visual Basic -> DAO RSS
Next:  How-To update a recordset from vb.net  
Author Message
Carl Morris

External


Since: Oct 16, 2003
Posts: 1



(Msg. 1) Posted: Thu Oct 16, 2003 2:28 pm
Post subject: Add an empty string to a field
Archived from groups: microsoft>public>vb>database>dao (more info?)

Hi,

In VB6

I have got a RecordSet (retrieved from an Acces database table) containing
one row. I want to edit the row and be able to add an empty string.

At the moment I do something like

rstTemp.Edit
rstTemp.Fields(0) = 45 ' some integer
rstTemp.Fields(1) = "jfjfkdkd"
rstTemp.Fields(3) = ""
rstTemp.Update

I get an error saying update failed because you cannot add a null value

Any advice?
Bert

 >> Stay informed about: Add an empty string to a field 
Back to top
Login to vote
DIOS1

External


Since: Sep 19, 2003
Posts: 9



(Msg. 2) Posted: Thu Oct 16, 2003 2:28 pm
Post subject: Re: Add an empty string to a field [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Add the string " " or if the field is not required then just skip it.

AGP


"Carl Morris" <rrrrr.DeleteThis@gfgfggf.com> wrote in message news:<uwzlLA9kDHA.1096.DeleteThis@TK2MSFTNGP11.phx.gbl>...
 > Hi,
 >
 > In VB6
 >
 > I have got a RecordSet (retrieved from an Acces database table) containing
 > one row. I want to edit the row and be able to add an empty string.
 >
 > At the moment I do something like
 >
 > rstTemp.Edit
 > rstTemp.Fields(0) = 45 ' some integer
 > rstTemp.Fields(1) = "jfjfkdkd"
 > rstTemp.Fields(3) = ""
 > rstTemp.Update
 >
 > I get an error saying update failed because you cannot add a null value
 >
 > Any advice?
 > Bert<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Add an empty string to a field 
Back to top
Login to vote
Unicorn1

External


Since: Aug 28, 2003
Posts: 2



(Msg. 3) Posted: Fri Oct 17, 2003 3:41 am
Post subject: Re: Add an empty string to a field [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Or change you database file to allow NULL value for that field

Matt

"DIOS" <sindizzy DeleteThis @softhome.net> wrote in message
news:7d00f3c.0310160619.4703520a@posting.google.com...
 > Add the string " " or if the field is not required then just skip it.
 >
 > AGP
 >
 >
 > "Carl Morris" <rrrrr DeleteThis @gfgfggf.com> wrote in message
news:<uwzlLA9kDHA.1096 DeleteThis @TK2MSFTNGP11.phx.gbl>...
  > > Hi,
  > >
  > > In VB6
  > >
  > > I have got a RecordSet (retrieved from an Acces database table)
containing
  > > one row. I want to edit the row and be able to add an empty string.
  > >
  > > At the moment I do something like
  > >
  > > rstTemp.Edit
  > > rstTemp.Fields(0) = 45 ' some integer
  > > rstTemp.Fields(1) = "jfjfkdkd"
  > > rstTemp.Fields(3) = ""
  > > rstTemp.Update
  > >
  > > I get an error saying update failed because you cannot add a null value
  > >
  > > Any advice?
  > > Bert<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Add an empty string to a field 
Back to top
Login to vote
Janne Kejo

External


Since: Aug 26, 2003
Posts: 10



(Msg. 4) Posted: Mon Oct 27, 2003 1:37 pm
Post subject: Re: Add an empty string to a field [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Or change your database to allow zero-length for that field

MyTable.Fields("MyField").AllowZeroLength = True

Janne

"Unicorn" <unicorn DeleteThis @midcoast.com.au> kirjoitti viestissä
news:OrpcvP$kDHA.2244@TK2MSFTNGP12.phx.gbl...
 > Or change you database file to allow NULL value for that field
 >
 > Matt
 >
 > "DIOS" <sindizzy DeleteThis @softhome.net> wrote in message
 > news:7d00f3c.0310160619.4703520a@posting.google.com...
  > > Add the string " " or if the field is not required then just skip it.
  > >
  > > AGP
  > >
  > >
  > > "Carl Morris" <rrrrr DeleteThis @gfgfggf.com> wrote in message
 > news:<uwzlLA9kDHA.1096 DeleteThis @TK2MSFTNGP11.phx.gbl>...
   > > > Hi,
   > > >
   > > > In VB6
   > > >
   > > > I have got a RecordSet (retrieved from an Acces database table)
 > containing
   > > > one row. I want to edit the row and be able to add an empty string.
   > > >
   > > > At the moment I do something like
   > > >
   > > > rstTemp.Edit
   > > > rstTemp.Fields(0) = 45 ' some integer
   > > > rstTemp.Fields(1) = "jfjfkdkd"
   > > > rstTemp.Fields(3) = ""
   > > > rstTemp.Update
   > > >
   > > > I get an error saying update failed because you cannot add a null
value
   > > >
   > > > Any advice?
   > > > Bert
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Add an empty string to a field 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Test for empty field in a DAO Recordset - Can anyone help me to determine when an integer field contains nothing? It seems to be different than a null variable and I can't remember how to do this simple thing. I'm using a DAO 3.6 Recordset If the Integer field [IDNumber] is blank or empty I..

PostgresSQL connect string - Hi does any one out there know how to build the Postgres SQL connect string for ADO connection? thanks any one who can help. -- George @ Lexington

DAO 3.6 record locking - Hi, Is it possible to programmatically lock a single record in a VB application using DAO 3.6? I would like to lock users' records when they log on to the app. Later I can check if a user's record is locked to see if they are logged in or not. (I....

Fixes for VB4 or DAO 3.0 - I've got VB4 (32-bit) and it seems to use DAO 3.0. Is there a service pack for either of these that I can use? I'm having issues with DAO and > 2GB of RAM on the machine, and don't want to have to move to a newer version of VB if I can help it, just t...

Jet error - I've just started getting this error message on a seemingly random basis. 'The Microsoft Jet database engine does not recognize 'CID' as a valid field name or expression.' CID is a text field, and it is a valid column name. The line of code that..
   Database Help (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]