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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report on fake recordset

Status
Not open for further replies.

Vidar13

IS-IT--Management
Apr 4, 2001
90
US
This may seem like a weird scenario, but here it goes. I have a one-to-many relationship with two tables, where there may, on occasion, be no records in the many, and I want to pick up on that circumstance and print a seperate report for the user to print a report (actually a hand-fill-in form) that is based on a number of arbitary record numbers.

My example is a purchase order. The end-user, enters the po header info and then enters line-items in a form. There are occasions when the user will not be able to enter any of the line item detail, but will instead want to print out a form (report) with X number of "blank lines". The X number is queried by code and I've already handled the code to launch the correct "fill-in" report. What I'm trying to do is figure out some way of faking the detail section of the report to create blank lines (or boxes, or whatever) X records long. Any suggestions? I could populate a temporary table x records long and base the report on that, but that seems like a lame way to go about this. If I could keep it contained in simple code and leave a temporary table out of it, it would be better.

Any ideas?
 
If I understand this correctly, how about using your query that already has the left join (or a similar query) as the row source for your detail report. Then include the field from the left table as a hidden field in the detail section. I think this should produce blank lines??

"Have a great day today and a better day tomorrow!
 
Well, it would, but it would only produce as many blank lines as there are records in the left-join table. That's the problem, because the end-user is ASKED how many blank lines they want.
 
Sorry, didn't see where the user could request number of lines.

In your case, I think you will need to have code that creates a temp table. :(

"Have a great day today and a better day tomorrow!
 
there are a couple of ways I can think of...

you could select non-exsistent fields from a table, e.g.
SELECT TOP 1000 "" AS Whatever FROM tblName
but this is limited to number of records in the table you choose...

or you could programatically generate new lines in the onFormat event of your report, check out the me.Print command

--------------------
Procrastinate Now!
 
Hi, I played around with this some and came up with this:

A text box on the form to input the number of desired lines.

A report with a number of lines set to invisible in the detail section.

Assign Tag Values to the controls you wish to hide.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

'Set Detail Height

Me.Detail.Height = 10080

'Hide Text Boxes, etc

Dim ctl As Control

For Each ctl In Me.Controls


If ctl.Tag = 10 Then 'Hide the control

ctl.Visible = False

End If

Next

'Set Lines According to Text Box Selection

Select Case Forms!form1.Text1

Case Is = 1

Me.Line1.Top = 2000
Me.Line1.Visible = True

Case Is = 2

Me.Line1.Top = 2000
Me.Line2.Top = 4000
Me.Line1.Visible = True
Me.Line2.Visible = True

Case Is = 3

Me.Line1.Top = 2000
Me.Line2.Top = 4000
Me.Line3.Top = 6000

Me.Line1.Visible = True
Me.Line2.Visible = True
Me.Line3.Visible = True
End Select

End Sub

Personally, I would create another report with the header info and give the user a set number rows for writing in information but that does kind of take the fun out of it.

Hope that Helps
 
Thank you for taking the time to reply on this! Yes, creating another report might solve the problem, but I wanted something more flexible.. and solving problems the code way is always more fun. ;)

I'll give it a shot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top