Hai Friends..
I have a form "Payroll" which contain two buttons named "PayrollbyDailyAttendance" and "PayrollbyMonthlyAttendance".I have given a code for these two buttons is as below.
Code:
Private Sub PayrollbyMonthlyAttendance_Click()
DoCmd.OpenForm "PayrollCreation", , , , , , "Monthly"
End Sub
Code:
Private Sub PayrollbyDailyAttendance_Click()
DoCmd.OpenForm "PayrollCreation", , , , , , "Daily"
EndSub
I have another form "PayrollCreation" which contain a text boxe named "txtNoofDaysWorked".
I have given the code on "PayrollCreation" onLoad event is as below
Code:
Private Sub Form_Load()
Select Case Nz(Me.OpenArgs, vbNullString)
Case "Daily"
Me.txtNoofDaysWorked.Value = DCount("[EmpID]", "Attendance", "[EmpID]='" & [cboEmpName] & "' AND [AttendanceMonth]='" & [cboMonth] & "' AND [AttendanceYear]='" & [cboYear] & "' AND [AttendanceStatus]='" & "Present" & "'")
Me.txtNoofDaysWorked.Requery
Case "Monthly"
Me.txtNoofDaysWorked.Value = 0
End Select
End Sub
but when I click "PayrollbyDailyAttendance" Button,
Me.txtNoofDaysWorked.Value = DCount("[EmpID]", "Attendance", "[EmpID]='" & [cboEmpName] & "' AND [AttendanceMonth]='" & [cboMonth] & "' AND [AttendanceYear]='" & [cboYear] & "' AND [AttendanceStatus]='" & "Present" & "'")
is working (I observed when clicking/changed design view to form view) but not Re-querying.
when I click "PayrollbyMonthlyAttendance" Button, "txtDaysWorked= "0" is working fine.
Please see my attached DB and get my exact problem...
Thanks in advance..