VBA
(1)
CmdAlternateChkBox
(1)
Report
(1)
HookomMicrosoft
(1)
TxtOddEven
(1)
MoveNext
(1)
OddEven
(1)
ChkBox
(1)
Print every other record in a form
Asked By Phillip
19-Mar-10 01:39 PM
Hi,
I have a continious form that gets selected records from a table. From the
records shown in the form I want to print pages for a book (left-facing,
right-facing). Is there a way to print two reports using the records shown
on my form? One report would select records 1, 3, 5 etc and the second
report would select records 2,4,6, etc.
Your help would be appreciated.
Thanks,
Forms are not meant for printing records. I would create a report forprinting.
Duane Hookom replied to Phillip
19-Mar-10 10:05 PM
Forms are not meant for printing records. I would create a report for
printing. Does each record fill an entire page? It seems like this would be
the only reason why you would want to print even pages and odd pages.
--
Duane Hookom
MS Access MVP
Hi Duane,Each record does not fill a page, but I want each record to be on a
Phillip replied to Duane Hookom
19-Mar-10 10:14 PM
Hi Duane,
Each record does not fill a page, but I want each record to be on a separate
page. Is there a way to have a report print every other record in a table
starting with the first record and then have another report to print every
other record starting with record 2?
Thanks,
Apparently you want the height of the detail section plus the page headerand
Duane Hookom replied to Phillip
20-Mar-10 02:07 AM
Apparently you want the height of the detail section plus the page header
and footer plus the top and bottom margins to equal the paper height. This
will print a single record on a page.
Consider adding a new column in your report's record source query:
OddEven: [Enter 1 for Odd or 0 for Even]
I would then try add a text box to the detail section:
Name: txtCount
Control Source: =1
Running Sum: Over All
Place another text box in the detail section:
Name: txtOddEven
Control Source: [OddEven]
Visible: No
Then add code to the On Format event of the detail section:
Cancel = (Me.txtCount Mod 2 <> Me.txtOddEven)
This is just some "air" code so try it and report back.
--
Duane Hookom
MS Access MVP
Hi again,Before I try that let me ask you another question.
Phillip replied to Duane Hookom
20-Mar-10 11:17 AM
Hi again,
Before I try that let me ask you another question. I currently have my form
listing the records. Each record has a check box which if it is checked and
I click on my command button for my report, those records print on separate
pages. Just what I want. I also have command bottons on my form that set on
or off the check boxes for all the records. Is there code for a command
button (for example a for/next loop) that would cycle through each record and
for each loop check or uncheck the check box for that record? For example:
for i = 1 to number of records
if i is even check box on
if i is odd check box off
next i
If this is possible then my current report would work.
Thanks again,
You can run some code to alternate check boxes.
Duane Hookom replied to Phillip
20-Mar-10 12:10 PM
You can run some code to alternate check boxes. Assuming the field name is
ChkBox the following code will work somewhat. The record that has the focus
in the form might not change so you need to watch for this. I just added a
command button that runs the code.
Private Sub cmdAlternateChkBox_Click()
Dim booCheck As Boolean
booCheck = True
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
With rs
.MoveFirst
Do Until .EOF
.Edit
!ChkBox = booCheck
.Update
booCheck = Not booCheck
.MoveNext
Loop
.Close
End With
End Sub
--
Duane Hookom
MS Access MVP
Hi again,I entered the code and I get a Compile error "User-defined type not
Phillip replied to Duane Hookom
20-Mar-10 01:12 PM
Hi again,
I entered the code and I get a Compile error "User-defined type not defined"
on the code:
Dim rs As DAO.Recordset
I am running Access 2000 if that makes a difference.
Thanks,
You might need to select Tools->References and set a reference to the
Duane Hookom replied to Phillip
20-Mar-10 02:51 PM
You might need to select Tools->References and set a reference to the
Microsoft DAO object library.
--
Duane Hookom
Microsoft Access MVP
Hi again,Yet another problem.....I do not have a "reference" under Tools.
Phillip replied to Duane Hookom
20-Mar-10 03:59 PM
Hi again,
Yet another problem.....
I do not have a "reference" under Tools.
Any ideas?
Phillip,You will need to go to the Tools - Reference in the VBA Module behind
Gina Whipp replied to Phillip
20-Mar-10 04:56 PM
Phillip,
You will need to go to the Tools - Reference in the VBA Module behind the
form.
--
Gina Whipp
2010 Microsoft MVP (Access)
II
http://www.regina-whipp.com/index_files/TipList.htm
Hi again,
Yet another problem.....
I do not have a "reference" under Tools.
Any ideas?
Thank you Duane and Gina. What I have works perfect.
Phillip replied to Gina Whipp
20-Mar-10 06:12 PM
Thank you Duane and Gina. What I have works perfect.
Thanks again,
Phil
More thanks to Duane... I was just passing by!
Gina Whipp replied to Phillip
20-Mar-10 07:34 PM
More thanks to Duane... I was just passing by!
--
Gina Whipp
2010 Microsoft MVP (Access)
II
http://www.regina-whipp.com/index_files/TipList.htm
Thank you Duane and Gina. What I have works perfect.
Thanks again,
Phil
Gina,Thanks for the pass-by assistance ;-)--Duane Hookom Access
Duane Hookom replied to Gina Whipp
21-Mar-10 12:18 AM
Gina,
Thanks for the pass-by assistance ;-)
--
Duane Hookom
Microsoft Access MVP
Anytime!
Gina Whipp replied to Duane Hookom
21-Mar-10 12:51 AM
Anytime!
--
Gina Whipp
2010 Microsoft MVP (Access)
II
http://www.regina-whipp.com/index_files/TipList.htm
Gina,
Thanks for the pass-by assistance ;-)
--
Duane Hookom
Microsoft Access MVP