MVP-looking for help with .addnew, Please help!!! 
Author Message
 MVP-looking for help with .addnew, Please help!!!

This is driving me crazy.  When I execute a .addnew on my rdoResultset I
get the following error: Run-time error 40039: can't assign value to
field unless in Edit mode.  The only way I can get it to work is be
adding an additional .addnew.  The update works then, but the second
time i click my cmd button to .addnew i get this error: Run-time error
40026: invalid result set state for update.

Here is the code I'm using:
    With rs
        .AddNew
        .AddNew
        !reptype = "New Record"
        !cmpcode = "New Record"
        !l1code = "New Record"
       .Update
       .Requery
       .MoveLast
    End With

Here's how I'm opening my rs:
**from global.bas**
Global cn As New rdoConnection
Global rs As rdoResultset

**proc**
    With cn
        .Connect = sConnect     'defined elsewhere obviously
        .CursorDriver = rdUseOdbc
        .EstablishConnection rdDriverNoPrompt
    End With

    Set rs = cn.OpenResultset("select * from reporting_hierarchy order
by reptype", rdOpenKeyset, rdConcurRowver)
    Set frmHierarchy.MSRDC1.Resultset = rs
    frmHierarchy.MSRDC1.Caption = "Record: " &
frmHierarchy.MSRDC1.Resultset.AbsolutePosition

I'd really appreciate it if someone could point me in the right
direction.  I can successfully edit/delete the rs from within my data
grid, but I need to be able to add records to it.

Thanks, Andre



Wed, 18 Jul 2001 03:00:00 GMT  
 MVP-looking for help with .addnew, Please help!!!
Have you tried,
With rs
.Edit

?

Quote:

>This is driving me crazy.  When I execute a .addnew on my rdoResultset I
>get the following error: Run-time error 40039: can't assign value to
>field unless in Edit mode.  The only way I can get it to work is be
>adding an additional .addnew.  The update works then, but the second
>time i click my cmd button to .addnew i get this error: Run-time error
>40026: invalid result set state for update.

>Here is the code I'm using:
>    With rs
>        .AddNew
>        .AddNew
>        !reptype = "New Record"
>        !cmpcode = "New Record"
>        !l1code = "New Record"
>       .Update
>       .Requery
>       .MoveLast
>    End With

>Here's how I'm opening my rs:
>**from global.bas**
>Global cn As New rdoConnection
>Global rs As rdoResultset

>**proc**
>    With cn
>        .Connect = sConnect 'defined elsewhere obviously
>        .CursorDriver = rdUseOdbc
>        .EstablishConnection rdDriverNoPrompt
>    End With

>    Set rs = cn.OpenResultset("select * from reporting_hierarchy order
>by reptype", rdOpenKeyset, rdConcurRowver)
>    Set frmHierarchy.MSRDC1.Resultset = rs
>    frmHierarchy.MSRDC1.Caption = "Record: " &
>frmHierarchy.MSRDC1.Resultset.AbsolutePosition

>I'd really appreciate it if someone could point me in the right
>direction.  I can successfully edit/delete the rs from within my data
>grid, but I need to be able to add records to it.

>Thanks, Andre



Fri, 20 Jul 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MVP-looking for help with .addnew, Please help!!!

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. Problem with my final macro (MVP help please)

4. PLEASE HELP PLEASE HELP PLEASE HELP

5. Help Please... AddNew Method error

6. Please help with AddNew problem...

7. Please Help: Enable a button during AddNew events?

8. Please help with AddNew problem...

9. Help please - error on addnew

10. ADO Addnew PLEASE HELP !!!

11. ADO + Access97: please help with AddNew-Method

12. AddNew, please help

 

 
Powered by phpBB® Forum Software