I am editing the sample database Northwinds, using the recordsetwrapper functions to edit data in Ticket Details once invoicing orders in the Invoice Details table.
However, nothing is getting updated in the Ticket Details table.
The procedure is run from a macro button form when saving the data in the Invoice Details table
MACRO COMMAND
----------------------------
SetProductStatus(Me![cbTicket], 3)
FUNCTIONS
------------------------------
Public Sub SetProductStatus(TicketID As Long, ProductStatus As TicketItemInvoiceStatusEnum)
Dim rsw As New RecordsetWrapper
If rsw.OpenRecordset("Ticket Details", "[Ticket ID] = " & TicketID) Then
With rsw.Recordset
If Not .EOF Then
.Edit
![Product Invoice Status ID] = ProductStatus
SetProductStatus = rsw.Update
End If
End With
End If
End Sub
FROM RECORDSETWRAPPER (Northwinds procedure)
---------------------------------------------------------------------
Option Compare Database
Option Explicit
Private m_rs As DAO.Recordset2
Public Function GetRecordsetClone(rs As DAO.Recordset2) As DAO.Recordset2
If Not m_rs Is Nothing Then
Debug.Assert False ' This is only designed to be used once
Else
Set m_rs = rs.Clone
Set GetRecordsetClone = m_rs
End If
End Function
Public Function OpenRecordset(Domain As String, _
Optional Criteria As String = "1=1", _
Optional OrderBy As String, _
Optional RecordsetType As DAO.RecordsetTypeEnum = dbOpenDynaset, _
Optional RecordsetOptions As DAO.RecordsetOptionEnum _
) As Boolean
If Not m_rs Is Nothing Then
' Close the recordset so it can be re-used
CloseRecordset
End If
Dim strSQL As String
strSQL = "SELECT * FROM [" & Domain & "] WHERE " & Criteria
If OrderBy <> "" Then
strSQL = strSQL & " ORDER BY " & OrderBy
End If
Set m_rs = CurrentDb.OpenRecordset(strSQL, RecordsetType, RecordsetOptions)
OpenRecordset = True
Done:
Exit Function
End Function
--------------------------------------------
It just doesn’t seem to find the data the data in Table Details to update the status to amend and not sure how to find out what bit is failing! I've been struggling with this for days!!!!!!!
HELP!!!
However, nothing is getting updated in the Ticket Details table.
The procedure is run from a macro button form when saving the data in the Invoice Details table
MACRO COMMAND
----------------------------
SetProductStatus(Me![cbTicket], 3)
FUNCTIONS
------------------------------
Public Sub SetProductStatus(TicketID As Long, ProductStatus As TicketItemInvoiceStatusEnum)
Dim rsw As New RecordsetWrapper
If rsw.OpenRecordset("Ticket Details", "[Ticket ID] = " & TicketID) Then
With rsw.Recordset
If Not .EOF Then
.Edit
![Product Invoice Status ID] = ProductStatus
SetProductStatus = rsw.Update
End If
End With
End If
End Sub
FROM RECORDSETWRAPPER (Northwinds procedure)
---------------------------------------------------------------------
Option Compare Database
Option Explicit
Private m_rs As DAO.Recordset2
Public Function GetRecordsetClone(rs As DAO.Recordset2) As DAO.Recordset2
If Not m_rs Is Nothing Then
Debug.Assert False ' This is only designed to be used once
Else
Set m_rs = rs.Clone
Set GetRecordsetClone = m_rs
End If
End Function
Public Function OpenRecordset(Domain As String, _
Optional Criteria As String = "1=1", _
Optional OrderBy As String, _
Optional RecordsetType As DAO.RecordsetTypeEnum = dbOpenDynaset, _
Optional RecordsetOptions As DAO.RecordsetOptionEnum _
) As Boolean
If Not m_rs Is Nothing Then
' Close the recordset so it can be re-used
CloseRecordset
End If
Dim strSQL As String
strSQL = "SELECT * FROM [" & Domain & "] WHERE " & Criteria
If OrderBy <> "" Then
strSQL = strSQL & " ORDER BY " & OrderBy
End If
Set m_rs = CurrentDb.OpenRecordset(strSQL, RecordsetType, RecordsetOptions)
OpenRecordset = True
Done:
Exit Function
End Function
--------------------------------------------
It just doesn’t seem to find the data the data in Table Details to update the status to amend and not sure how to find out what bit is failing! I've been struggling with this for days!!!!!!!
HELP!!!
Last edited: