Re: Crash saving boolean value to RS (Row cannot be located...)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Brendan Reynolds (brenreyn)
Date: 10/06/04


Date: Wed, 6 Oct 2004 16:42:13 +0100

Well, as I indicated earlier, a Jet Boolean (Yes/No) field will not store a
Null value, but a numeric field should be OK.

-- 
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com
The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
"rpotash" <rpotash@discussions.microsoft.com> wrote in message 
news:02D91A9A-54F9-42AE-B66D-0638426C1A87@microsoft.com...
> Val: I have a PK and it is part of the SELECT statement.
>
> Brendan: I read a note on ADO translating changes to UPDATE statements and
> what you're saying makes sense. The following code works:
>
>   Open RecordSet
>    With rs
>        .AddNew
>        !FullName = "Hello"
>       .Update
>    End With
>
>   Close RecordSet
>   Open RecordSet
>    With rs
>        !System = True
>       .Update
>    End With
>
> The issue I'm dealing with is that I was attempting to store the Gender
> (True=Male, False=Female, NULL=Not Specified). I haven't tried number 
> fields.
>
> BTW, Does anyone know a good lightweight bound Grid Control which allows 
> me
> to change the header and row colorsets? I'm using the Infragistics 
> UltraGrid
> for just this reason but it's forcing me to ADO and has more
> properties/events then I need or care to learn about at this point.
>
> Thanks for the help,
> Rich...
>
>
> "Brendan Reynolds" wrote:
>
>> What if you give the Boolean (Yes/No) field a default value. Does that 
>> make
>> a difference?
>>
>> I haven't tested this, but here's what I'm thinking ...
>>
>> In VBA within an Access application, you can assign a Null value to a
>> Boolean (Yes/No) field without any error, despite the fact that a Jet
>> Boolean (Yes/No) field can not actually store a Null value. The Null gets
>> implicitly converted to False. So what I think may be happening here is 
>> that
>> when you create the new record, the value of the Boolean field in the
>> recordset is Null, but when the record gets saved, it gets implicitly
>> converted to False. If ADO then attempts to find the same record using 
>> logic
>> such as "WHERE TheBooleanField IS NULL .." it won't find it.
>>
>> -- 
>> Brendan Reynolds (MVP)
>> http://brenreyn.blogspot.com
>>
>> The spammers and script-kiddies have succeeded in making it impossible 
>> for
>> me to use a real e-mail address in public newsgroups. E-mail replies to
>> this post will be deleted without being read. Any e-mail claiming to be
>> from brenreyn at indigo dot ie that is not digitally signed by me with a
>> GlobalSign digital certificate is a forgery and should be deleted without
>> being read. Follow-up questions should in general be posted to the
>> newsgroup, but if you have a good reason to send me e-mail, you'll find
>> a useable e-mail address at the URL above.
>>
>>
>> "rpotash" <rpotash@discussions.microsoft.com> wrote in message
>> news:22E1A4A5-2F65-4C0C-A909-83B7DED00A47@microsoft.com...
>> >I am connecting an ADO recordset to an Access table. When adding a new
>> > record, if I don't store a value in a boolean field before the first
>> > update,
>> > the system crashes during subsequent updates of the boolean field. This
>> > only
>> > seems to happen with booleans.
>> >
>> > ' This works...
>> >    With rs
>> >        .AddNew
>> >        !System = True              ' Yes/No
>> >        .Update
>> >        !FullName = "Hello"         ' Text
>> >        .Update
>> >        !System = True
>> >        .Update
>> >    End With
>> >
>> >
>> > ' This crashes...
>> >    With rs
>> >        .AddNew
>> >        !FullName = "Hello"
>> >        .Update
>> >        !System = True
>> >        .Update                        ' Error (80040e38) Row cannot be
>> > located for updating. Some values may have been changed since it was 
>> > last
>> > read.
>> >    End With
>> >
>> >
>>
>>
>> 


Relevant Pages

  • RE: Listview: Show Checked Items Only
    ... Simplest solution would be to create a disconnected recordset with a boolean ... Mark this boolean field to True for each record that are checked by the user. ... boolean field for records with value True; wipe off the listview and populate ... I've a feeling that is a listbox control though. ...
    (microsoft.public.vb.controls)
  • RE: Using values in an array to assign a recordset variable
    ... For a fixed array - you know how many row's and column's you need already ... Dim aryas Boolean '1st argument is row 2nd argument is col ... This syntax is assuming that the column in your recordset holding the ... determine the code to execute based on the True or False column in the ...
    (microsoft.public.vb.database.ado)
  • Re: Using values in an array to assign a recordset variable
    ... I don't want to load the array with values from my recordset. ... up the next value..assign it to the variable, inset into the SAME sql ... depending upon whether the boolean value, in my variable, is True or false. ...
    (microsoft.public.vb.database.ado)
  • Re: Lock data access
    ... that Release Date is control on the form and you are comparing a date field ... if the date in the recordset is more than 30 ... Dim blnEnableEdits as Boolean ...
    (microsoft.public.access.gettingstarted)
  • Re: TRUE is 0 is FALSE
    ... An explicit literal - in string form - for boolean values don't seem ... equivalent simpler code that does not store a boolean in a variable. ... it will reflect the exit status of the last command in the ... the prominent shells support some form ...
    (comp.unix.shell)