I don't know what I'm doing yet and maybe I'm going about this the wrong way. I'm trying to come up with a count of records meeting variable criteria.
My code is:
What I want is to have a form where the user inputs fldCounter.Name and fldCounter.Value instead of using the hard-coded inputs I've got, and have the record count (of those meeting the criteria) displayed on the form.
I'm trying to teach myself Access and I'm somewhat bewildered. Any suggestions would be greatly appreciated!
My code is:
Code:
Sub TestGetInput()
DoCmd.OpenForm "InquireWithin", acNormal
Dim TrackingDB As Object
Dim TrackingFields As Object
Dim fldCounter As Object
Dim fldColumns As Object
Dim RcdCount As Integer
RcdCount = 0
Set TrackingDB = CurrentDb
Set TrackingFields = TrackingDB.OpenRecordset("Tracking")
Set fldColumns = TrackingFields.Fields
' Scan the records from beginning to each
While Not TrackingFields.EOF
' Check the current column
For Each fldCounter In TrackingFields.Fields
' [COLOR=blue]I want the user to put this in from the form[/COLOR]
If fldCounter.Name = "CallType" Then
' [COLOR=blue]I want the user to put this in from the form[/COLOR]
If fldCounter.Value = "Transfer" Then
' then add to the record count
RcdCount = RcdCount + 1
End If
End If
Next
' Move to the next record
TrackingFields.MoveNext
Wend
End Sub
What I want is to have a form where the user inputs fldCounter.Name and fldCounter.Value instead of using the hard-coded inputs I've got, and have the record count (of those meeting the criteria) displayed on the form.
I'm trying to teach myself Access and I'm somewhat bewildered. Any suggestions would be greatly appreciated!