467,920 Members | 1,186 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

2 checkboxes and a continuos form

Hi folks.

I have a query, qryHistory, which has the following field:

DaysOverdue: IIf([Due]<Date(),DateDiff("d",[Due],Nz([Return],Date())),0)

I also have a form (continuos), frmHistory, which is based on

frmHistory has a checkbox, chkReturn, which has the following code
below. chkReturn assigns the current date to Return and calculates
Fine based on DaysOverdue and a few other criteria's. When chkReturn
is clicked again, the changes will be undone.

Private Sub chkReturn_Click()
Static X
X = X + 1
If X > 2 Then X = 1

Select Case X:
Case 1: Me.Return = Date
If Me.DaysOverdue > 0 Then
If (Me.MemType = "Staff") Or (Me.MemType = "Lecturers")
Me.Fine = Me.DaysOverdue
End If

If (Me.MemType = "Student(PT)") Or (Me.MemType =
If Me.DaysOverdue > 7 Then
Me.Fine = (7 * 0.5) + (Me.DaysOverdue - 7)
Me.Fine = Me.DaysOverdue * 0.5
End If
End If
End If

Case 2: Me.Return = Null
Me.Fine = Null
End Select
End Sub
I originally wanted DaysOverdue and Fine to be calculated when the
form is opened; however, assigning the calculations to the form's
OnOpen event failed (partly because of the fact that it is continuos,
I suspect). Someone in the forum suggested that I assign the coding of
DayOverdue to the query, which I did, and it worked (thank you!!!).
Which then leaves Fine, which I assigned to a checkbox, which works.
But I also want the form to calculate Fine when the form is opened.
Any ideas?

FrmHistory also has another checkbox, chkRenew. This is it's coding:
Private Sub Renew_Click()
Static X
X = X + 1
If X > 2 Then X = 1

Select Case X:
Case 1: Me.Borrow = Date
Me.Due = Date + 7
Me.Return = Null

Case 2: Me.Undo
End Select
End Sub
If I click on chkRenew, the values of Borrow and Due will be changed
as per the coding above, and if I click on chkRenew again, the changes
will be undone. However, if I click on chkRenew the 1st time, then
sort the form (or edit it in any way), then click on that specific
chkRenew the 2nd time, the values of Borrow and Due will not be
changed back to its original value. How do I correct this?
Nov 13 '05 #1
  • viewed: 1018

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Pete | last post: by
8 posts views Thread by Ralph Freshour | last post: by
3 posts views Thread by Ian | last post: by
reply views Thread by Rick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.