Conflict with Record Counter and Print check box selector
I have created a new navigation bar for my form, as the one Access provides is very small and hard to read. The problem is with the Record counter code is conflicting with a Print Selector button that already exists on my form. I use the Print Selector button when I have filtered the form down to say 20 records that I want. Then when I click the button, it automatically checks a bound check box for all 20 records, so I don’t have to do it one by one. I use this check box as a record selector to then run reports or do more filtering. Now when I click the button it only checks the first record but not the rest. I did not write the code for the Print Selector button and do not entirely understand how it works. But, I think I know what the conflict is I just don’t know how to fix it. Both codes run through the record set to select records that have been filter, one counts them the other updates. The line that causes the problems is line 3 in the Record Counter, but if I take it out it does not work properly. The codes are below.
Record counter: (in On Current of Form)
Print Selector button:
I have look at changing both codes but have had no luck. Does anyone have any suggestion on how to resolve this with changes to either of the codes?
I have created a new navigation bar for my form, as the one Access provides is very small and hard to read. The problem is with the Record counter code is conflicting with a Print Selector button that already exists on my form. I use the Print Selector button when I have filtered the form down to say 20 records that I want. Then when I click the button, it automatically checks a bound check box for all 20 records, so I don’t have to do it one by one. I use this check box as a record selector to then run reports or do more filtering. Now when I click the button it only checks the first record but not the rest. I did not write the code for the Print Selector button and do not entirely understand how it works. But, I think I know what the conflict is I just don’t know how to fix it. Both codes run through the record set to select records that have been filter, one counts them the other updates. The line that causes the problems is line 3 in the Record Counter, but if I take it out it does not work properly. The codes are below.
Record counter: (in On Current of Form)
Code:
Private Sub Form_Current()
With Me
If RecordsetClone.RecordCount > 0 Then .RecordsetClone.MoveLast
!txtRecordDisplay = "" & .CurrentRecord & " of " & .RecordsetClone.RecordCount
!cmdFirst.Enabled = .CurrentRecord <> 1 'And Not .NewRecord
!cmdPrevious.Enabled = .CurrentRecord <> 1 'And Not .NewRecord
!cmdNext.Enabled = .CurrentRecord <> .RecordsetClone.RecordCount 'And Not .NewRecord
!cmdLast.Enabled = .CurrentRecord <> .RecordsetClone.RecordCount 'And Not .NewRecord
End With
End Sub
Code:
Private Sub filtog_Click()
On Error GoTo Err_filtog_Click
Set DBase = CurrentDb()
Set Fc = Forms![frmDescription]
Set filttogrecset = Fc.RecordsetClone
If filttogrecset.EOF Then
filttogrecset.MoveFirst
End If
Dim Searcher As Integer
Searcher = 0
Do While Not filttogrecset.EOF
Me.Bookmark = filttogrecset.Bookmark
filttogrecset.Edit
filttogrecset!Search = True
filttogrecset.Update
Searcher = Searcher + 1
filttogrecset.MoveNext
Loop
filttogrecset.Close
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
txt_ToggleCounter.Value = CStr(Searcher) + " item(s) are toggled"
Exit_filtog_Click:
Exit Sub
Err_filtog_Click:
MsgBox Err.Description
Resume Exit_filtog_Click
End Sub
Comment