B
Brandon
Hello
I found a help file that shows an ado recordset object being applied to a forms recordset. I tried the example and everything worked except that I would not allow writing the data back to the database. I have included the following code
Dim RecSet As ADODB.RecordSe
Dim cn As ADODB.Connectio
Dim cmd As ADODB.Comman
Dim param As ADODB.Paramete
Set cn = CurrentProject.Connectio
Set cmd = New ADODB.Comman
With cm
.ActiveConnection = c
.CommandType = adCmdStoredPro
.CommandText = "sproc_inventory
End Wit
Set param = New ADODB.Paramete
With para
.name = "Item
.TYPE = adVarCha
.Value =sValu
.Direction = adParamInpu
.Size = 1
End Wit
cmd.Parameters.Append para
Set RecSet = New ADODB.RecordSe
With RecSe
.LockType = adLockOptimisti
.CursorType = adOpenDynami
.CursorLocation = adUseClien
End Wit
Set RecSet = cmd.Execut
Set forms("formname").RecordSet = RecSe
Set cn = Nothin
Set cmd = Nothin
Set param = Nothin
According to the help file, I should be able to read and write. I can only read the recordset. I get the following error
Field is based on an expression and can't be edited. The store procedure is has several joins. I know the SPROC will work because I switched it to the recordsource and I was able to read and write. I would prefer using the ado code.
Thank you
Brandon
I found a help file that shows an ado recordset object being applied to a forms recordset. I tried the example and everything worked except that I would not allow writing the data back to the database. I have included the following code
Dim RecSet As ADODB.RecordSe
Dim cn As ADODB.Connectio
Dim cmd As ADODB.Comman
Dim param As ADODB.Paramete
Set cn = CurrentProject.Connectio
Set cmd = New ADODB.Comman
With cm
.ActiveConnection = c
.CommandType = adCmdStoredPro
.CommandText = "sproc_inventory
End Wit
Set param = New ADODB.Paramete
With para
.name = "Item
.TYPE = adVarCha
.Value =sValu
.Direction = adParamInpu
.Size = 1
End Wit
cmd.Parameters.Append para
Set RecSet = New ADODB.RecordSe
With RecSe
.LockType = adLockOptimisti
.CursorType = adOpenDynami
.CursorLocation = adUseClien
End Wit
Set RecSet = cmd.Execut
Set forms("formname").RecordSet = RecSe
Set cn = Nothin
Set cmd = Nothin
Set param = Nothin
According to the help file, I should be able to read and write. I can only read the recordset. I get the following error
Field is based on an expression and can't be edited. The store procedure is has several joins. I know the SPROC will work because I switched it to the recordsource and I was able to read and write. I would prefer using the ado code.
Thank you
Brandon