N
Noel
Hi. Dirk Goldgar helped me produce the following code but
its behaving rather oddly. My original post is at the end
of this one. When I click on the command button that
calls up this code, I get the message "The Microsoft Jet
database engine stopped the process because you and
another user are attempting to change the same data at
the same time." This is not correct as I am in a backup
copy. In any case, when I immediately click on the button
again, the process runs correctly. If I look at the
results immediately after it fails, I see that the first
part of the process has worked - this is the bit where
the existing Checks are cleared using an update query
called "School Addr Labels Clear Checks". So the two
parts of the code dont seem to want to run together. Can
anyone, or Dirk if you read this, see whats wrong? Is
there a more elegant way to clear all existing checks
before running Dirks code? Thanks, Noel
Private Sub cmdCheckFilteredSet_Click()
On Error GoTo Err_cmdCheckFilteredSet_Click
DoCmd.SetWarnings False
Dim stDocName As String
stDocName = "School Addr Labels Clear Checks"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
With Me.RecordsetClone
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do Until .EOF
.Edit
!PrintLabel = True
.Update
.MoveNext
Loop
End With
Exit_cmdCheckFilteredSet_Click:
Exit Sub
Err_cmdCheckFilteredSet_Click:
MsgBox Err.Description
Resume Exit_cmdCheckFilteredSet_Click
End Sub
Original Post:
I have a form with a Check Box which is used to determine
which records are picked up by a Mail Merge document. The
users simply go through the records and tick the ones
they want to Merge.
This is fine for a small number of records but heres the
question. Assume the user filtered the recordset to show,
say, all records appropriate to a certain County. Say
this produces 200 records. Rather than the user having to
go through all 200 records ticking the boxes, would it be
possible to have a command button that calls up some sort
of process that automatically ticks the Check Box in each
of the records in the filtered set?
its behaving rather oddly. My original post is at the end
of this one. When I click on the command button that
calls up this code, I get the message "The Microsoft Jet
database engine stopped the process because you and
another user are attempting to change the same data at
the same time." This is not correct as I am in a backup
copy. In any case, when I immediately click on the button
again, the process runs correctly. If I look at the
results immediately after it fails, I see that the first
part of the process has worked - this is the bit where
the existing Checks are cleared using an update query
called "School Addr Labels Clear Checks". So the two
parts of the code dont seem to want to run together. Can
anyone, or Dirk if you read this, see whats wrong? Is
there a more elegant way to clear all existing checks
before running Dirks code? Thanks, Noel
Private Sub cmdCheckFilteredSet_Click()
On Error GoTo Err_cmdCheckFilteredSet_Click
DoCmd.SetWarnings False
Dim stDocName As String
stDocName = "School Addr Labels Clear Checks"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
With Me.RecordsetClone
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do Until .EOF
.Edit
!PrintLabel = True
.Update
.MoveNext
Loop
End With
Exit_cmdCheckFilteredSet_Click:
Exit Sub
Err_cmdCheckFilteredSet_Click:
MsgBox Err.Description
Resume Exit_cmdCheckFilteredSet_Click
End Sub
Original Post:
I have a form with a Check Box which is used to determine
which records are picked up by a Mail Merge document. The
users simply go through the records and tick the ones
they want to Merge.
This is fine for a small number of records but heres the
question. Assume the user filtered the recordset to show,
say, all records appropriate to a certain County. Say
this produces 200 records. Rather than the user having to
go through all 200 records ticking the boxes, would it be
possible to have a command button that calls up some sort
of process that automatically ticks the Check Box in each
of the records in the filtered set?