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