I have a form whose recordsource is based on a query, which has 2 sets of criteria ( date range and person). In the footer of this continous form i have added a total text box with a running sum and a textbox of the recordcount (txtcount). i want to get a percentage in another textbox (txtpercent) based on txtcount and only the records with the word "booked" in qactive field of form.
Here is the current code i have:
Private Sub Form_GotFocus()
Dim db As DAO.Database
Dim rcdcnt As Integer
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = Me.RecordsetClone
rcdcnt = 0
While Not rst.EOF
If Me.qactive = "booked" Then
rcdcnt = (rcdcnt + 1)
End If
rst.MoveNext
Wend
Me.txtpercent.Value = ([txtcount] / [rcdcnt])
End Sub
It compiles but doesnt give me a value in txtpercent.
What am i doing wrong here? any suggests are most welcome.
Raven