venu_resoju
Registered User.
- Local time
- Today, 23:52
- Joined
- Dec 29, 2010
- Messages
- 129
Hai Friends....
I have a form named "PayrollCreation" and have given a code to save button to writing 2no of records as mentioned below...
Private Sub Command87_Click()
On Error GoTo cmdSave_Click_Err
On Error Resume Next
Dim db As DAO.Database
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Set db = CurrentDb
Set rst1 = db.OpenRecordset("Payroll")
Set rst2 = db.OpenRecordset("LoanTransactions")
rst1.AddNew
rst1!EmpName = Me!cboEmpName.Column(1)
rst1!EPFNo = Me!txtEPFNo
rst1!ESINo = Me!txtESINo
rst1!PayPeriod = Me.cbomonth & "-" & Me.cboYear
rst1!WageRate = Me!txtwagerate
rst1!WorkingDays = Me!txtWorkingDays
rst1!NoofDaysWorked = Me!txtNoofDaysWorked
rst1!Basic = Me.txtBasic
rst1!EPF = Me.txtEPFD
rst1!ESI = Me.txtESID
rst1!NetPay = Me.txtNetPay
rst1.Update
rst1.Close
rst2.AddNew
rst2!EmpName = Me!cboEmpName.Column(1)
rst2!TransnDate = Date
rst2!TransnType = "Deduction"
rst2!Sanctions = "0"
rst2!Deductions = Me.txtAdvance
rst2!LoanName = "Salary Deduction"
rst2.Update
rst2.Close
On Error GoTo 0
cmdSave_Click_Exit:
Exit Sub
cmdSave_Click_Err:
MsgBox Error$
Resume cmdSave_Click_Exit
End Sub
the above code is working fine but I want to write the Second record / impliment rst2, I f Me.txtAdvance < 0 else do Nothing. What changes can I do in the above code
Thanks in advance....please anyone help me...
I have a form named "PayrollCreation" and have given a code to save button to writing 2no of records as mentioned below...
Private Sub Command87_Click()
On Error GoTo cmdSave_Click_Err
On Error Resume Next
Dim db As DAO.Database
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Set db = CurrentDb
Set rst1 = db.OpenRecordset("Payroll")
Set rst2 = db.OpenRecordset("LoanTransactions")
rst1.AddNew
rst1!EmpName = Me!cboEmpName.Column(1)
rst1!EPFNo = Me!txtEPFNo
rst1!ESINo = Me!txtESINo
rst1!PayPeriod = Me.cbomonth & "-" & Me.cboYear
rst1!WageRate = Me!txtwagerate
rst1!WorkingDays = Me!txtWorkingDays
rst1!NoofDaysWorked = Me!txtNoofDaysWorked
rst1!Basic = Me.txtBasic
rst1!EPF = Me.txtEPFD
rst1!ESI = Me.txtESID
rst1!NetPay = Me.txtNetPay
rst1.Update
rst1.Close
rst2.AddNew
rst2!EmpName = Me!cboEmpName.Column(1)
rst2!TransnDate = Date
rst2!TransnType = "Deduction"
rst2!Sanctions = "0"
rst2!Deductions = Me.txtAdvance
rst2!LoanName = "Salary Deduction"
rst2.Update
rst2.Close
On Error GoTo 0
cmdSave_Click_Exit:
Exit Sub
cmdSave_Click_Err:
MsgBox Error$
Resume cmdSave_Click_Exit
End Sub
the above code is working fine but I want to write the Second record / impliment rst2, I f Me.txtAdvance < 0 else do Nothing. What changes can I do in the above code
Thanks in advance....please anyone help me...