Report Record Source

L

Lionel Fridjhon

I have a report called "rptInventory" that I need to be
able to print from any one of 9 identical tables. The
tables are named "tblInventory1" through "tblInventory9".

I have procedure that runs on the "On Format" event that
I think can be used to write another line of code
setting "Record Source" for the report.

How do I do this?

Lionel
 
S

Steve Schapel

Lionel,

I think you'll find that a report's recordsource can only be changed
on the On Open event of the report.
Me.Recordsource = "tblInventory"

As a side issue, the existence of "9 identical tables" would almost
certainly indicate a design flaw in the database, which is probably
making life more difficult than necessary for you. If you are
interested in some advice with this aspect, post back with some
details of these tables, either here or in the tablesdbdesign
newsgroup.

- Steve Schapel, Microsoft Access MVP
 
L

Lionel Fridjhon

Steve
Thanks for all the input.

I now have the piece of code that you sent me to show the
Windows print dialog box. It looks like this:
=====================
Private Sub cmdRunReport_Click()
Dim Response As Integer
On Error Resume Next
Response = MsgBox("Do you want a preview
before sending to the printer", vbYesNo, "PREVIEW?")
If Response <> 7 Then
DoCmd.OpenReport ("rptInventory"),
acViewPreview
Else
DoCmd.OpenReport ("rptInventory"),
acViewNormal
End If
DoCmd.SelectObject
acReport, "rptInventory"
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "rptInventory"
End Sub
======================================
If I press "No" the print spools straight to my default
printer, and then offers me the dialog box for selecting
the printer I want, which then prints not hte report, but
the form on which the command button is residing.
If I press "Yes" everything works fine, but there is
apparently so much work for the computer to assemble
first the preview,and then spool to the printer that it
does not complete the insertion of all the images, aznd
prints with half of them missing.

This is also the reason I have broken up the database
into nine tableswith identical design, with different
data for each page of the printout.

I agree that there must be a serious design flaw in my
database, and would welcome some input from you.

Can I send you the whole database without the images?
It is about 465 Kb.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top