I am working on a client information form with a general information/demographics on the tab and six tabs on the botton half for membership, activities, events, organizations, roles, and donations. It is based on a query consisting of the person and membership tables, and I have a save button to save the membership pricing to a transaction table for receipting purposes. Anyway, my problem is that the form when I click the save button the form is going to a new record as well and this I do not want to happen because the client may be registering for activities or events at the same time and so clearing the record entry could be extremely frustrating to front desk personnel when busy. I cannot not find anything in my code that is causing the new record change.
Here is the code:
Private Sub btnMbrshipSave_Click()
' Subroutine for adding new records to the memberships table from data entry form
' Creates variable for data recordsets
Dim rstMbrshipTransaction As DAO.Recordset
Dim rstSalesNumber As DAO.Recordset
Dim rstErrors As DAO.Recordset
' Sets up error handling for custom message box
On Error GoTo ErrorControl
' Initializes dataset record subset
Set rstMbrshipTransaction = CurrentDb.OpenRecordset("tblTransactions", dbOpenDynaset)
Set rstSalesNumber = CurrentDb.OpenRecordset("tblSalesNo", dbOpenDynaset)
Set rstErrors = CurrentDb.OpenRecordset("tblErrors", dbOpenDynaset)
' Check for Sales Receipt Number
If IsNull(Me.txtSalesRcptNo.Value) = True Then
Me.txtSalesRcptNo.Value = rstSalesNumber!SalesRcptNo
rstSalesNumber.Edit
rstSalesNumber!SalesRcptNo = Me.txtSalesRcptNo + 1
rstSalesNumber.Update
End If
' Adds and updates new record to transaction table from data entry form
With rstMbrshipTransaction
.AddNew
!PersonID = Me.txtPersonID.Value
!SalesRcptNo = Me.txtSalesRcptNo.Value
!transactionDate = Me.txtMbrshipOriginationDate.Value
!transactionItem = Me.cbxMbrshipTypeID.Value
!transactionDesc = Me.cbxMbrshipTypeID.Column(2)
!transactionQty = 1
!transactionRate = Me.txtMbrshipAmt.Value
.Update
End With
GoTo EndStatements
' Error handling for membership additions and sending error information to errors table
ErrorControl:
Call MsgBox("An error has occurred in Tigress. Please contact your Tigress Administrator.")
With rstErrors
.AddNew
!errorNumber = Err.Number
!errorDesc = Err.Description
!errorSource = Err.Source
!errorModuleName = "btnMbrshipSave_Click"
.Update
End With
EndStatements:
' Clears the data recordset
Set rstMbrshipTransaction = Nothing
Set rstSalesNumber = Nothing
Set rstErrors = Nothing
End Sub
Thank you so much any help you can provide.
tsb49
YWCA of Greater Lafayette
Here is the code:
Private Sub btnMbrshipSave_Click()
' Subroutine for adding new records to the memberships table from data entry form
' Creates variable for data recordsets
Dim rstMbrshipTransaction As DAO.Recordset
Dim rstSalesNumber As DAO.Recordset
Dim rstErrors As DAO.Recordset
' Sets up error handling for custom message box
On Error GoTo ErrorControl
' Initializes dataset record subset
Set rstMbrshipTransaction = CurrentDb.OpenRecordset("tblTransactions", dbOpenDynaset)
Set rstSalesNumber = CurrentDb.OpenRecordset("tblSalesNo", dbOpenDynaset)
Set rstErrors = CurrentDb.OpenRecordset("tblErrors", dbOpenDynaset)
' Check for Sales Receipt Number
If IsNull(Me.txtSalesRcptNo.Value) = True Then
Me.txtSalesRcptNo.Value = rstSalesNumber!SalesRcptNo
rstSalesNumber.Edit
rstSalesNumber!SalesRcptNo = Me.txtSalesRcptNo + 1
rstSalesNumber.Update
End If
' Adds and updates new record to transaction table from data entry form
With rstMbrshipTransaction
.AddNew
!PersonID = Me.txtPersonID.Value
!SalesRcptNo = Me.txtSalesRcptNo.Value
!transactionDate = Me.txtMbrshipOriginationDate.Value
!transactionItem = Me.cbxMbrshipTypeID.Value
!transactionDesc = Me.cbxMbrshipTypeID.Column(2)
!transactionQty = 1
!transactionRate = Me.txtMbrshipAmt.Value
.Update
End With
GoTo EndStatements
' Error handling for membership additions and sending error information to errors table
ErrorControl:
Call MsgBox("An error has occurred in Tigress. Please contact your Tigress Administrator.")
With rstErrors
.AddNew
!errorNumber = Err.Number
!errorDesc = Err.Description
!errorSource = Err.Source
!errorModuleName = "btnMbrshipSave_Click"
.Update
End With
EndStatements:
' Clears the data recordset
Set rstMbrshipTransaction = Nothing
Set rstSalesNumber = Nothing
Set rstErrors = Nothing
End Sub
Thank you so much any help you can provide.
tsb49
YWCA of Greater Lafayette