we have a database of students, where we maintain their particulars specially fee fee history, i.e. which students have paid their fee and who have not yet paid. For this purpose we generate a fee slip every month.
When i click the 'Generate' button on the form, a required fee slip is generated for the selected month and student.
But the problem is that when i click the generate button again the same fee slip is generated again for the same selected month, which i don't want to be so. i want to change this behavior like if fee slip for a particulars month say May or June exists, the duplicate should not be generated if the button is click again and again.
i have provided the sample of Fee Slip Generate 'form' and 'report' to understand the problem.
i have also provided VBA code of the Generate button. please help.
When i click the 'Generate' button on the form, a required fee slip is generated for the selected month and student.
But the problem is that when i click the generate button again the same fee slip is generated again for the same selected month, which i don't want to be so. i want to change this behavior like if fee slip for a particulars month say May or June exists, the duplicate should not be generated if the button is click again and again.
i have provided the sample of Fee Slip Generate 'form' and 'report' to understand the problem.
i have also provided VBA code of the Generate button. please help.
Private Sub Command32_Click()
Dim dbs As Database
Dim Months As Integer
Dim mdate As Date
Set dbs = CurrentDb()
Me.Text26 = CDate("01" & "/" & Month(Me.Text26) & "/" & Year(Me.Text26))
Me.Text28 = CDate("01" & "/" & Month(Me.Text28) & "/" & Year(Me.Text28))
Months = Month(Me.Text26)
mdate = Me.Text26
If Me.Frame0.Value = 1 Then
DoCmd.OpenQuery "School Selected"
ElseIf Me.Frame0.Value = 2 Then
DoCmd.OpenQuery "Class Selected"
ElseIf Me.Frame0.Value = 3 Then
DoCmd.OpenQuery "Class&Section Selected"
ElseIf Me.Frame0.Value = 4 Then
DoCmd.OpenQuery "Student Selected"
End If
'MsgBox& Year(Me.Text28)
DoCmd.OpenQuery "Delete Transport Charges" ' Delete all those record have transport charges but no bus no.
DoCmd.OpenQuery "Delete Free Transport Records" ' Delete all those record have transport charges but FREE.
DoCmd.OpenQuery "Deduct Concession"
DoCmd.OpenQuery "Tuition Fee is zero" ' Delete where tuition fee =0
While mdate <= Me.Text28
dbs.Execute "Update [Tmp School] Set [Tmp School].[Fee Month] = '" & mdate & "'"
DoCmd.OpenQuery "School Append"
mdate = DateAdd("m", 1, mdate)
Wend
DoCmd.OpenQuery "Previous-Final"
dbs.Close
'DoCmd.OpenTable "Generated fee"
Me.Combo15.Enabled = False
Me.Combo19.Enabled = False
Me.Heads_subform.Enabled = False
MsgBox "Fee generated for the reqired Student(s)...", vbOKOnly
End Sub