Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: RecordSet Unable to Update?

Geek News

RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/5/2008 9:36:23 AM
hi,

There is this 'funny' situation I don't quite understand.

1. I had a recordset open>> rd.Open table, conn, adOpenStatic,
adLockPessimistic
2. Data is able to be extract and perform arithmatic operations.
3. Programatically I tried>>
OnCancel_Button_Click()

TotalDays_Text = CDec (TotalDays_Text)
Taken_Text = CDec (Taken_Text)
Balance_Text = CDec(Balance_Text)

'Before Operation ************************
a= msgbox(rd!taken & rd!balance)

Taken_Text = Taken_Text - TotalDays_Text
Balance_Text = Balance_Text + TotalDays_Text

rd!taken = Taken_Text
rd!balance = Balance_Text

'After Operation **************************
a= msgbox(rd!taken & rd!balance)

' Am able to display here the value after operations, but back end table
there is no UPDATE ?
' In other form I am able to use similar methods to perform the arimithic
operations but this not on this form.
'I check with the form setting did set to allowededit = true too

Edison

--
Message posted via http://www.accessmonster.com

RE: RecordSet Unable to Update?
April 12/5/2008 9:25:36 PM
Try changing the adOpenStatic to adOpenDynamic. With it opening as static I
don't think you can just update it, dynamic should allow you to use rs.Update
to update it.

"edisonl via AccessMonster.com" wrote:

[Quoted Text]
> hi,
>
> There is this 'funny' situation I don't quite understand.
>
> 1. I had a recordset open>> rd.Open table, conn, adOpenStatic,
> adLockPessimistic
> 2. Data is able to be extract and perform arithmatic operations.
> 3. Programatically I tried>>
> OnCancel_Button_Click()
>
> TotalDays_Text = CDec (TotalDays_Text)
> Taken_Text = CDec (Taken_Text)
> Balance_Text = CDec(Balance_Text)
>
> 'Before Operation ************************
> a= msgbox(rd!taken & rd!balance)
>
> Taken_Text = Taken_Text - TotalDays_Text
> Balance_Text = Balance_Text + TotalDays_Text
>
> rd!taken = Taken_Text
> rd!balance = Balance_Text
>
> 'After Operation **************************
> a= msgbox(rd!taken & rd!balance)
>
> ' Am able to display here the value after operations, but back end table
> there is no UPDATE ?
> ' In other form I am able to use similar methods to perform the arimithic
> operations but this not on this form.
> 'I check with the form setting did set to allowededit = true too
>
> Edison
>
> --
> Message posted via http://www.accessmonster.com
>
>
RE: RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/6/2008 2:11:07 AM
Hi April,

Thanks for replying..

All right from what you had said.. here 's the funny part..

I had other form open(within the same program) as openstatic but its
updatable....But not this particular form..

Another perculiar scenerio, likewise you said previously I tried using
OpenDynamic But A2K do not allow to update & explicitly pop up error mesaage
saying Update operation not available.

Edison


April wrote:
[Quoted Text]
>Try changing the adOpenStatic to adOpenDynamic. With it opening as static I
>don't think you can just update it, dynamic should allow you to use rs.Update
>to update it.
>
>> hi,
>>
>[quoted text clipped - 29 lines]
>>
>> Edison

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

RE: RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/17/2008 2:55:09 AM
Hi April,

Am afraid that something new crop up this time round.
I search for a particular record.

rd.open "MyForm", conn, adOpenDynamic, adLockOptimistic
rd.filter "Name='" & Name_Text & " '"

do until rd.EOF
If recordset=0 then
rd.addnew
.
.

else
rd.update
.
.
end if

rd.movenext
loop

rd.close
conn.close
set rd = nothing
set conn = nothing


"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~
Error: Operation not allows in this context
"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~

Edison






X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
X X X X X X X X X X X X
April wrote:
[Quoted Text]
>Try changing the adOpenStatic to adOpenDynamic. With it opening as static I
>don't think you can just update it, dynamic should allow you to use rs.Update
>to update it.
>
>> hi,
>>
>[quoted text clipped - 29 lines]
>>
>> Edison

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

RE: RecordSet Unable to Update?
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 12/17/2008 4:14:41 AM
You named your table "MyForm"? Some may confused it with a form not a table
or a query syntax.

"Name" is a reserved word in access. Try not to use it. If you can't change
it now, use a square bracket to enclose the reserved name object like "[Name]
='".

Do a compact and repair, see if the problem goes away.

Here's a helpful link to get you started.

http://www.accessmvp.com/Strive4Peace/Index.htm

http://home.att.net/~california.db/tips.html#aTip1

edisonl wrote:
[Quoted Text]
>Hi April,
>
>Am afraid that something new crop up this time round.
>I search for a particular record.
>
>rd.open "MyForm", conn, adOpenDynamic, adLockOptimistic
>rd.filter "Name='" & Name_Text & " '"
>
>do until rd.EOF
>If recordset=0 then
> rd.addnew
> .
> .
>
>else
> rd.update
> .
> .
>end if
>
>rd.movenext
>loop
>
>rd.close
>conn.close
>set rd = nothing
>set conn = nothing
>
>"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~
>Error: Operation not allows in this context
>"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~"~
>
>Edison
>
> X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
>X X X X X X X X X X X X
>>Try changing the adOpenStatic to adOpenDynamic. With it opening as static I
>>don't think you can just update it, dynamic should allow you to use rs.Update
>[quoted text clipped - 5 lines]
>>>
>>> Edison

--
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

RE: RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/17/2008 4:23:02 AM
Hi Van,

Thanks for your reply, I use the name loosely to enable easy understanding
when explaining to you guys thats all.

Edison

AccessVandal wrote:
[Quoted Text]
>You named your table "MyForm"? Some may confused it with a form not a table
>or a query syntax.
>
>"Name" is a reserved word in access. Try not to use it. If you can't change
>it now, use a square bracket to enclose the reserved name object like "[Name]
>='".
>
>Do a compact and repair, see if the problem goes away.
>
>Here's a helpful link to get you started.
>
>http://www.accessmvp.com/Strive4Peace/Index.htm
>
>http://home.att.net/~california.db/tips.html#aTip1
>
>>Hi April,
>>
>[quoted text clipped - 37 lines]
>>>>
>>>> Edison
>

--
Message posted via http://www.accessmonster.com

RE: RecordSet Unable to Update?
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 12/17/2008 9:55:51 AM
Than, I'm not sure your code statement is correct.

rd.filter "Name='" & Name_Text & " '"

Should it be

rd.filter = "Name='" & Name_Text & " '"

Which line the error point to?

edisonl wrote:
[Quoted Text]
>Hi Van,
>
>Thanks for your reply, I use the name loosely to enable easy understanding
>when explaining to you guys thats all.
>
>Edison

--
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: RecordSet Unable to Update?
Stefan Hoffmann <ste5an[ at ]ste5an.de> 12/17/2008 10:04:55 AM
hi,

as I don't see the OP, this is just a guess...

AccessVandal via AccessMonster.com wrote:
[Quoted Text]
> Than, I'm not sure your code statement is correct.
> rd.filter = "Name='" & Name_Text & " '"
.... remove the space before the closing single quote.



mfG
--> stefan <--
Re: RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/18/2008 12:23:58 AM
Hi Van/Stefan,

1. Yap no issue about the space and '=' sign

2. Though I refrained myself from any embarassement (though it still happen
at time, arghh..) by making those mistakes.

3. Anyway had managed to replace all the opening code with
*****************************************
strsql ="My Sql Statement"
currentdb.execute strsql
*****************************************

Stefan Hoffmann wrote:
[Quoted Text]
>hi,
>
>as I don't see the OP, this is just a guess...
>
>> Than, I'm not sure your code statement is correct.
>> rd.filter = "Name='" & Name_Text & " '"
>... remove the space before the closing single quote.
>
>mfG
>--> stefan <--

--
Message posted via http://www.accessmonster.com

Re: RecordSet Unable to Update?
"AccessVandal via AccessMonster.com" <u18947[ at ]uwe> 12/18/2008 12:56:59 AM
I’m aware of the space. I just leave it as it is, since we don’t have a clue
to his actual code or what he had intent to do with his pseudo code.

Stefan Hoffmann wrote:
[Quoted Text]
>hi,
>
>as I don't see the OP, this is just a guess...
>mfG
>--> stefan <--

--
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: RecordSet Unable to Update?
"edisonl via AccessMonster.com" <u47544[ at ]uwe> 12/19/2008 7:00:30 AM
Hi Van & Stefan:

Its me again .

Just some info sharing... After 1 big wild goose chase I finally realised, I
need to
do another line of code thats all >>

rd.UpdateBatch adAffectCurrent

to 'complete' the table process, then Access allows me to

rd.close, set rd=nothing...

Like to thank both for the effort in guiding me.. ;p
Cheers



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
AccessVandal wrote:
[Quoted Text]
>I’m aware of the space. I just leave it as it is, since we don’t have a clue
>to his actual code or what he had intent to do with his pseudo code.
>
>>hi,
>>
>>as I don't see the OP, this is just a guess...
>>mfG
>>--> stefan <--
>

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net