Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing blank recs to print

Status
Not open for further replies.

Soladmin

MIS
Feb 8, 2002
18
US
I have a report with 3 fields printing inside of text boxes and 3 more boxes next to them in the detail part of my report...
It should look something like this

HR Mary 123 ____ ____ _____
MIS JOHN 456 _____ ____ _____
FINANCE PETER 789 _____ ____ ____
ACCTNG GINA 109 ____ ____ ____
SUPPORT SUSAN 347 ____ ____ ____

I would like to know how to force 5 blank recs if the number of recs per group is less than 5. I have a Runningsum which tells me already how many recs are in each group. (If the group does'nt have enough detail to fill the page then print blank boxes). My report is running off a query which is correct..I verified the data ..There are no duplicate recs..this is not why the names appear over and over.
I think I need code to tell it to count the number of recs...if it's less than 5 then fill the detail with blank recs (wherever the dept,name and id would go) along with the boxes... right now having the name and boxes prints something like this (WHERE each _____ represents a box.)

HR Mary 123 ____ ____ _____
HR Mary 123 _____ ____ _____
HR Mary 123 _____ ____ ____
HR Mary 123 ____ ____ ____
HR Mary 123 ____ ____ ____

I added this VBA code but I get an error Run Time 348
“Object doesn’t support this property or method.”
It does’nt seem to like the ME!NEWDEPT.visible=False

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.RSUM1 < 5 Then
Ptot = 5 - Me.RSUM1
Psum = 1
Do
  Me!NEWDEPT.Visible = False
  Me!NAME.Visible = False
  Me!EMPLID.Visible = False
  Me!MoveLayout = True
  Me.PrintSection = True
Psum = Psum + 1
Loop Until Psum > Ptot
End If
End Sub

Any suggestions???
Please help !.. this is my first time writing an Access report






 

ok...but what about the rest of it ?... why do I get the run time error...I get it at the

Me!NEWDEPT.Visible=false

line...
 
What type of control is Me!NEWDEPT ? Have you checked the property page for the control to see if it supports the visible setting?
 
Me!NEWDEPT is a textbox... and yes I did check and the visible property is allowed... I followed the example is help... the only difference is that it was being used in a form...but the explanation stated that this can be done on both forms and reports.
One of the key points that I don't get is where should the code go? I have it in the detail_print right now...is that ok for waht I'm trying to do?



 
I'm not sure if it's possible to do what you want to do. To check for work-arounds, what is your intent with the code?

You can use sorting and grouping to keep related items properly contained.

You can cause Access to force a new page before or after grouping sections.

The code you have now simply sets the visible property of the fields multiple times, it has no effect on what records are being displayed on the report.
 
I already have my sort and grouping set..
Field/Expression Sort Order
NEWDEPT ASCENDING

Group properties
Group Header = Yes
Group footer = No
Group On = each value
Group Interval = 1
Keep together = no

I wish I could've inserted my print screen in here ..it would be easier to see what I've done ... so instead I'll try to describe what I got..
The report contains
1 page header (label with caption= &quot;Employee sign in sheet&quot;)
1 group header (&quot;NEWDEPT header&quot; as specified above...with no text boxes or labels in it...I cannot put NEWDEPT in that section because it doesn't correspond to the format that is expected by the payroll dept. It has to be in the detail section next to each name.)
1 detail
1st row contains labels for Dept,Name employeeID and the days of the week.
2nd row contains 3 text boxes for NEWDEPT,NAME,EMPID where the control source is set to the field name from the Query the report is running from.
There are also Labels next to those fields directly under the day of the week.Those have no caption as they're used to display blank boxes where the employee would put there initial every day they've worked.
1 page footer (automatic page number and label for the manager's signature)

Hope I'm being more confusing...
 
Although this is excellent information, and will likely prove useful later, I still don't know why you want to pad out your report to 5 rows (substituting blank rows where necessary).

FYI, if you want to use the force new page capabilities, you have to use the property page on the section header/footers.
 
Thanks for the tip...somehow forcing a page seems to put the info together the way I want it ... of course I'm getting an extra blank page after each record...but I'll probably be figure that out...
to answer your question... the reason I want to pad out the report with 5 rows is because of user requirements. The report has to follow a certain format,the users are not willing to modify and I don't want to loose my job.so unfortunately I still need help adding the other rows with blank data.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top