morning all,
have done a search but have not found any solutions to my problem.
i have a recordset returned from a query. before i open the next form (and set that forms recordset = the recordset that the query returned0 i need to make some changes to the fields in the recordset (and not make any changes to the tabels that provided the data.
any suggestions?
regards,
longhair
have done a search but have not found any solutions to my problem.
i have a recordset returned from a query. before i open the next form (and set that forms recordset = the recordset that the query returned0 i need to make some changes to the fields in the recordset (and not make any changes to the tabels that provided the data.
Code:
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
Dim dbs As DAO.Database
Dim qdfPostDtl As DAO.QueryDef
Dim intRecCount1 As Integer
Dim i As Integer
'txtName = Me.Form.Text4
'txtName = Me.Form.Text4
Set dbs = CurrentDb
intVoucher = Me.Form.voucher
Set qdfPostDtl = dbs.QueryDefs("VendDtl")
qdfPostDtl.Parameters("pQueryVoucher") = intVoucher
'rstPostDtl declared as public at module level
Set rstPostDtl = qdfPostDtl.OpenRecordset(dbOpenDynaset)
intRecCount1 = rstPostDtl.RecordCount
If intRecCount1 > 0 Then
'rstPostDtl2 declared as public at module level
Set rstPostDtl2 = rstPostDtl
rstPostDtl2.MoveFirst
With rstPostDtl2
For i = 1 To intRecCount1
If .Fields(1) <> "V" Then
.Edit
.Fields(3) = ""
.Fields(4) = .Fields(10)
'.Update
End If
MsgBox .Fields(1) & " " & .Fields(3) & " " & .Fields(4)
Next i
End With
stDocName = "VendDtl2"
DoCmd.OpenForm stDocName, , , acFormReadOnly
Else: MsgBox "No Voucher Details Found for " & intVoucher
rstPostDtl.Close
Set rstPostDtl = Nothing
End If
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
regards,
longhair