[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Print a Previewed Report

Posted on 2005-04-24
45
Medium Priority
?
611 Views
Last Modified: 2011-09-20
When I print preview a report, it is OK.  When I click the print button, the report loses focus and what was a backfground form, prints instead of my report.  Help please
0
Comment
Question by:BethWoodhouse
  • 23
  • 22
45 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13855568
What happens if you close the background form, THEN try to print the report

Does the background form re-open?
0
 

Author Comment

by:BethWoodhouse
ID: 13855628
Yes, I close the background form then try the print button and the closed form still tries to print and because the form is based on a query with 120 records, the print causes a 120 page report to begin printing!  I let the first page print to confirm that it is still printing the form.
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13856065
BethWoodhouse,

Let's try a quick test.

Rename the form that keeps trying to print.
Then close it.
Then open your report and try again.

I have a feeling your print button may be opening the form.
Is the print button you are clicking on the form itself, or are you clicking the Print button on the toolbar?
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 

Author Comment

by:BethWoodhouse
ID: 13856198
The form that is printing is the form that has the key data and a "Create Report" command button on it.  The report then opens in preview mode in front of the form.  I am clicking the print button on the Access toolbar expecting it to print the report that is open in preview mode and has the focus.  

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13856241
BethWoodhouse,

When you renamed the form that keeps printing, did the same thing happen?

Please post the code that is on the "OnClick" event of the "Create Report" button.

0
 

Author Comment

by:BethWoodhouse
ID: 13856335
If I rename the form that keeps printing, my report (or the query on which the report is based) will not be able to collect its parameter.  The code behind my "Create Report" button is below.  
When I run the report, I have 3 forms open, a menu form, the second form is showing the customer (selected from combo box) with that customer's jobs (sub form).  The third is the selected job with the "Create Report" button.  If I print the report directly to the printer acViewNormal then all works well.  With the acViewPreview, it appears correctly in the screen but when I click the access toolbar print button, a report of about 120 pages (which is the number of customers) is prepared and it starts printing the customer form (second form) many times....(I interrupt that pretty quickly).
I must be misssing something here....


Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

    Dim stDocName As String
   
    If Me.One_Piece = True Then
        stDocName = "Stringing_Report1"
    Else
        stDocName = "Stringing_Report2"
    End If
   
   DoCmd.OpenReport stDocName, acViewPreview

Exit_cmdPrint_Click:
    Exit Sub

Err_cmdPrint_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrint_Click
   
End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13856668
OK,

That looks good.....

Hey,
Perhaps I am missing something too......

Some things to try:

1. While all of the forms are open (do not open the report), what if you tried opening a generic report and tried to print it?

2. Does the same problem occur for both "Stringing" reports (Stringing_Report1, and Stringing_Report2)?
Try Toggling "One_Piece" to find out.

3. While all three forms are open, (do not open the report), try selecting one of the other forms and try to print that one.

4. With the Report open, go into design view and look at the "ToolBar" and "Menubar" properties. Is anything listed?(Perhaps this Report has it's own "Custom" Print toolbar, that looks just like the standard one)

Let me know the results of each of these tests.
0
 

Author Comment

by:BethWoodhouse
ID: 13858256
1. With the 3 forms open, I can print preview and then print an unrelated report quite satisfactorily.
2.  The same problem occurs with both reports, yes.
3.  When I have the 3 forms open, regardless of which one has the focus, the FIRST or menu form always is the one that prints and it actually comes to the front of the other two.   If I then close the first or menu form, and try to print one of the other two forms, the first (closed) form still prints.  
4.  Both toolbar and menubar properties are blank.

It looks like a form property that could be the problem?
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13858843
BethWoodhouse,

Ok let's look at ALL the code on the form that always wants to print out all thoes records.

Go into design view of this form ("Select Job", correct?).
Click: View-->Code

Copy all the code by pressing Ctrl-A, copy it, then paste it here.
0
 

Author Comment

by:BethWoodhouse
ID: 13890179

Sorry about the delay as I have been off the air!

This is the code from the form that previews the report.
...............................
Option Compare Database
Option Explicit


Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

    DoCmd.Close
       
Exit_cmdClose_Click:
    Exit Sub

Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
   
End Sub

Private Sub Form_Load()

    DoCmd.GoToRecord , , acNewRec

End Sub

Private Sub JobID_BeforeUpdate(Cancel As Integer)
Me.JobID = JobID

End Sub

Private Sub String_Date_BeforeUpdate(Cancel As Integer)
If IsNull(String_Date) Then
    MsgBox "Date is Required"
    End If
   
End Sub

Private Sub String_E1_Change()

If Me.String_E1.Column(1) = "" Then
Me.String_E1Price = 0
Else
Me.String_E1Price = Me.String_E1.Column(2)
End If
Call Total_Sum

End Sub
Private Sub String_E2_Change()
If Me.String_E2 = "" Then
Me.String_E2Price = 0
Else
Me.String_E2Price = Me.String_E2.Column(2)
End If

Call Total_Sum
End Sub
Private Sub String_E3_Change()
If Me.String_E3 = "" Then
Me.String_E3Price = 0
Else
Me.String_E3Price = Me.String_E3.Column(2)
End If

Call Total_Sum

End Sub

Public Sub Total_Sum()
String_Total_Price = (IIf(IsNull(String_E1Price), 0, String_E1Price)) _
     + (IIf(IsNull(String_E2Price), 0, String_E2Price)) _
   + (IIf(IsNull(String_E3Price), 0, String_E3Price)) _
  + (IIf(IsNull(String_Price), 0, String_Price))
   
End Sub

Private Sub String_Price_BeforeUpdate(Cancel As Integer)
Call Total_Sum
End Sub


Private Sub String_Price_LostFocus()
Call Total_Sum
End Sub

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click


    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Exit_Command37_Click:
    Exit Sub

Err_Command37_Click:
    MsgBox Err.Description
    Resume Exit_Command37_Click
   
End Sub
Private Sub cmdRacquets_Click()
On Error GoTo Err_cmdRacquets_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmRacquets"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdRacquets_Click:
    Exit Sub

Err_cmdRacquets_Click:
    MsgBox Err.Description
    Resume Exit_cmdRacquets_Click
   
End Sub
Private Sub cmdMaterials_Click()
On Error GoTo Err_cmdMaterials_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmMaterial"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdMaterials_Click:
    Exit Sub

Err_cmdMaterials_Click:
    MsgBox Err.Description
    Resume Exit_cmdMaterials_Click
   
End Sub
Private Sub cmdExtras_Click()
On Error GoTo Err_cmdExtras_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmExtras"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdExtras_Click:
    Exit Sub

Err_cmdExtras_Click:
    MsgBox Err.Description
    Resume Exit_cmdExtras_Click
   
End Sub
Private Sub cmdClients_Click()
On Error GoTo Err_cmdClients_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmClients"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdClients_Click:
    Exit Sub

Err_cmdClients_Click:
    MsgBox Err.Description
    Resume Exit_cmdClients_Click
   
End Sub
Private Sub cmdErase_Click()
On Error GoTo Err_cmdErase_Click

    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Exit_cmdErase_Click:
    Exit Sub

Err_cmdErase_Click:
    MsgBox Err.Description
    Resume Exit_cmdErase_Click
   
End Sub
Private Sub Command55_Click()
On Error GoTo Err_Command55_Click
 Dim stDocName As String
 
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
     
    If Me.One_Piece = True Then
       
        stDocName = "Stringing_ReportN1"
    Else
        stDocName = "Stringing_ReportN2"
    End If
   
   DoCmd.OpenReport stDocName, acViewPreview
   

   
Exit_Command55_Click:
    Exit Sub

Err_Command55_Click:
    MsgBox Err.Description
    Resume Exit_Command55_Click
   
End Sub
Private Sub CmdSave_Click()
On Error GoTo Err_CmdSave_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_CmdSave_Click:
    Exit Sub

Err_CmdSave_Click:
    MsgBox Err.Description
    Resume Exit_CmdSave_Click
   
End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13890491
I'll have a look tonight and let you know
0
 

Author Comment

by:BethWoodhouse
ID: 13890545
Thanks.
What appears to print is the first form that I open.  If I start at form1, then open form2 and then form3, when I preview the report (generated from form3 above) and then say print, then form1 comes into focus and it prints.  If I start at form2, well this one comes into focus and prints and since form2 is based on a query of many records, I get a 100+ page report wanting to print.  Is there some form property that could be set on both forms?
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13892355
BethWoodhouse,
OK,

Let's make a copy of the database and work from that (to be on the safe side)
Name this copy "TestFixPritProblem"

1.Compile the code.
Open the ("TestFixPritProblem") database
Press: Alt-F11 (To open Visual Basic)
Click: Debug-->Compile

Compact and Repair this database ("TestFixPrintProblem")
Click: Tools-->Database Utilities-->Compact and Repair Database

Then test for the problem.

2.Reset AND Restore the "Print Preview" and "Form View Toolbars
(These are the toolbars that contain "Print" Icons)
Click: Tools-->Customize
Click the "Toolbars" tab
Select (just select it, be careful not to Un-check it) the "Form View" toolbar.
Click "Reset". It will ask you "Are you sure?", click "OK"
Now click the "Properties" button.
Then click the "Restore Defaults" button.
It will ask you "Are you sure?”, click "Yes"
Now repeat the above steps for the "Print Preview" toolbar.
Close the Customize dialog box and EXIT the database (File-->Exit)
Then re-open the database and test for the problem.

3.Create a blank Database.
Name it "TestImport" and Import all the objects form the old one into this blank one
In the Blank Database, click: File-->Get External Data-->Import
Click on the "Tables" tab, and click the "Select All" button.
Click on the "Queries" tab, and click the "Select All" button.
Repeat this for all the tabs, and click: "Import"
Compact and Repair this database.
Then test for the problem.

3.Go back to the first "Copy" of the database "TestFixPrintProblem"
Open the Report in Design View.
Click: View-->Code
Click: Edit-->Find
Type in:           DoCmd.PrintOut
(This is the Command for printing)
Then click the "Current Project" Option button.
Then Click: "Find Next"
If you do not find any matches, that all you can do.
If you find anything that matches, put an Apostrophe in front of it
   'DoCmd.Printout
This will disable the command
Close out of the Visual Basic window.
Then test for the problem.

4. Move the copy "TestFixPrintProblem", to another machine.
Then test for the problem.

If you do all this and nothing fixes the problem.

The very last thing to try is to "Decompile" the Database.
But this is the Last Resort!

Try the above first and let me know the result.
0
 

Author Comment

by:BethWoodhouse
ID: 13893739
Hi boag2000,
I have done all but the last step.  As well, I have made a completely new report and a completely new menu form and the same thing still happens for me. I preview the report and then once I click either File/Print or the printer icon on the database toolbar, the menu form assumes focus and then that is what prints.  I will try another computer tomorrow.    Thanks for you patience!
0
 

Author Comment

by:BethWoodhouse
ID: 13924235
Hi boag200,
I found the same thing happens on another computer.  What I did discover is that If I have a report in preview mode on the screen and I right click and then click print, well the report will print OK.  Clicking the printer icon or using File/Print will always print the form which jumps into focus.

Beth
   
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13931374
Beth,

I dug a little deeper, try this:

Open up the report (The one that's giving us problems) normally.
Click Tools-->Customize
Click the "ToolBars" tab
Then Right-Click the Printer ICON on the toolBar
Click "Properties"
Take a look at the "On Action" and "Parameter" fields
Make sure they are empty!!!!!

If anything is in either Field, Delete it out!
Exit the database and Retest for the problem.

I was able to duplicate your symptoms by creating a function that Opens and Prints out a Form. I then "Called" the function from the "Parameter" field. It did just as you said, It brought the Form to the front and started printing it!

If that does not work, please retry this:
2.Reset AND Restore the "Print Preview" and "Form View Toolbars
(These are the toolbars that contain "Print" Icons)
Click: Tools-->Customize
Click the "Toolbars" tab
Select (just select it, be careful not to Un-check it) the "Form View" toolbar.
Click "Reset". It will ask you "Are you sure?", click "OK"
Now click the "Properties" button.
Then click the "Restore Defaults" button.
It will ask you "Are you sure?”, click "Yes"
Now repeat the above steps for the "Print Preview" toolbar.
Close the Customize dialog box and EXIT the database (File-->Exit)
Then re-open the database and test for the problem.


Now if this does not work you need to find a Public website to post your entire Database, Create a copy and post that. If it has any sensitive data delete it or replace it with generic Values.

If it is posted, at least I can Download it and take a look

Let me know how this all works out.
0
 

Author Comment

by:BethWoodhouse
ID: 13931686
hi boag200,
Do you mean open in preview or design mode?  IN either mode, I go tools/customise then select a toolbar, say database and then all I can do is click on the command tab and then on the RHS I have all the icons for a particular category (including the priner icon under category file) with their titles but I cannot right click on anything?  All I can do is rearrange.  The modiofy option is inactivated.
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13931720
Open the REPORT in PREVIEW
Then Click: Tools-->Customize
Click the "ToolBars" tab
Do not select a Toolbar!
While the "Customize" Dialog box is still open, go directly to the PRINTER ICON on the toolBar
Then Right-Click the PRINTER ICON on the toolBar
Click "Properties"
Take a look at the "On Action" and "Parameter" fields
Make sure they are empty!!!!!

If anything is in either Field, Delete it out!
Exit the database and Retest for the problem.

Sorry for any confusion
0
 

Author Comment

by:BethWoodhouse
ID: 13931752
There is nothing in those fields.  I will have to send the database to you but have to go out right now, back later,
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13932080
Post it to a public Wesite

I'll be waiting
0
 

Author Comment

by:BethWoodhouse
ID: 13955758
I put it on    bethwd201.tripod.com

thanks
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13956084
Reviewing it now,

I'll be in touch tomorrow
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13961013
OK  BethWoodhouse,

I'm at work looking at your database that I downloaded yesterday.

What steps do I have to take (Forms to open, Buttons to click), to recreate the problem you are having?
0
 

Author Comment

by:BethWoodhouse
ID: 13963007
boag2000,

open frmMain then select a client, say Fred Bloggs, then 'edit'  one of the entries, then choose 'stringing report' and the report will preview.  Then choose to print using the printer icon on the database toolbar (or print on the File menu).
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13963335
There is no "Stringing Report" on the Clients Form.
There is no "Stringing Report" on the Main form either.

Did I do something wrong?

Here is what I did:

I opened "frmMain"
It has 5 buttons along the left
I clicked the one that said "Clients"
I then "Edited" Fred Blogs phone number to 16314997929

Now, at this point I have 2 forms open and neither form has a "Stringing Report" button?

Both "frmStringingDetail" and "frmStringingDetailNew" forms DO have this button. Which one of thoes forms should I open?
0
 

Author Comment

by:BethWoodhouse
ID: 13963893
Sorry but I did miss a step.  from the main form, choose 'Stringing' then choose a client from the combo box, then edit one of his records then print a stringing report from frmStringingDetail.

The other pathway is to choose stringing, choose a customer/client,  their records display (if any), then choose New Stringing to add a record then print from that screen.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13966213
Bev,

OK I think I got it.

Lets Fix it first, if it works we can go through the reasoning.
Note! Make a backup and use that for this test!

1. Open each of the three Forms, one at a time, in Design View and set the "Pop Up" property to "NO" (I bet you can figure out what that did!)(frmMain, frmStringing, frmStringingDetails)
2. Save and close them all in sequence.
3. Open "qryStringingReport" in Design View.
4. Scroll over to the JobID Field and Delete the Criteria, (Do Not Delete the Field, just the Criteria. JobID will be synchronized to the Form)
5. Save and Close.
6. Open "frmStringingDetails" in Design View.
7. Open up the code on the "On Click" Event of the "Stringing Report" Button (aka. btnPrint)
8. Delete the entire On Click Procedure (Not the Entire Module, Just the "On Click" Code) and paste this in:

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

    Dim stDocName As String
   
    If Me.One_Piece = True Then
        stDocName = "Stringing_Report1"
    Else
        stDocName = "Stringing_Report2"
    End If
   
    'Saves the Current Record on the Form so that
    'edits on the Form are reflected in the Report
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    'Previews the Report Sychronized to the same Record as the Form
    DoCmd.OpenReport stDocName, acViewPreview, , "[JobID]=[Forms]![frmStringingDetails]![JobID]"

Exit_cmdPrint_Click:
    Exit Sub

Err_cmdPrint_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrint_Click
   
End Sub


9. Click: Debug-->Compile (It will generate an error about "Wrong Number of Arguments"
Replace this line:
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria, , acWindowNormal

With this one:
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria, acWindowNormal
(There was an extra comma)
10. Click: Debug-->Compile, again (This time there should not be any errors)
11.Close Visual Basic
12. Close the Property Box
13. Save and close any Forms
14. Re-open the Forms in sequence and test for the "ABSENCE" of the problem!

If this works you will probably have to cahnge any other Forms, Queries or Reports to match the logic I have here.

Let me know ASAP if it works!

This has got to be worth more than 50 points!
:)
0
 

Author Comment

by:BethWoodhouse
ID: 13966280
Since I am not very experienced, I thought it would be so simple for an expert!  However I will increase the points before I even have a go as I can see the amount of time and effort involved!  I will be in touch and let you know the outcome.
0
 

Author Comment

by:BethWoodhouse
ID: 13966482
I just found out that 500 is max!
Beth
0
 

Author Comment

by:BethWoodhouse
ID: 13967728
I did these things and still have the problem but a little different.  Now when I click the printer icon or file/print I get a different form printing instead of my report.  Previously it was frmMain that always came into focus and printed, now it is the last form to open or frmStringingDetails that comes into focus and prints.
 
One thing above that confused me was the compile error you talked of as I did not get that and am not sure where the statement with the extra comma is to be found.  
Lots of point now :)
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13967790
Try downloading the file you posted on the website.

That is the one I tested it on, and it worked for me.

0
 

Author Comment

by:BethWoodhouse
ID: 13967838
I did use the same one as I uploaded, I thought.  I will try with a downloaded copy tomorrow.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13969035
Just to be sure,

I'll post all of the code on all of my forms here (The three tht we were concerned about) . (From my version that works)
And the SQL behind the query.
0
 

Author Comment

by:BethWoodhouse
ID: 13974544
Hi boag2000
I downloaded the version I put there for you and repeated the steps and still the same thing happens.  The frmStringingDetails comes into focus as soon as I click the printer icon or file/print on database toolbar.  The form prints instead of the report.  That report will not stay in focus.....
0
 

Author Comment

by:BethWoodhouse
ID: 13974860
another thing that happens..
If I have the report in preview mode and CLOSE all the forms, when I click print, it still prints frmStringing but the entire page is 'tiled' with that form.  NOT just once copy...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13974951
Strange......

In that Database there were a few other "Forms", "queries", and "Reports".

I only modified the 3 forms, 1 Report and 1 Query that I listed.

If you choses another one of these it might not work. You would have to make the appropriate changes in al of the objects.

On that Error:
"Wrong Number of Arguments".
If you open the Downloaded file and go straight to Visual Basic, (Press Alt-F11) and click:
Debug-->Compile. It should bring you to this line.

     DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria, , acWindowNormal

This is on Command55, ("Stringing Report" button on "frmPrint")
You do not get this error? If you notice on that line there are 2 commas between:
stLinkCriteria, , acWindowNormal
There should only be one, that's why you should get the error.

I will go through my steps again tonight, just to be sure.

If mine works again with no problems, tell me how, and I will "Upload" my version to your public website.

OR

Put another link on your site with the database you tried to fix with my instructions. So I can test both.

BTW: When did the database start giving you these problems?


0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13975424
Bev,

This may look like my last post, but I re-wrote to correct some of my writing

Please follow the steps again. Please don't take this the wrong way, my assumption is that if it worked for me then perhaps my wording was at fault, not your reading.
:)


OK I think I got it.

Lets Fix it first, if it works we can go through the reasoning.

Note! Grab a Fresh copy of the database from your website.

1. Open each of the three Forms, one at a time, in Design View and set the "Pop Up" property to "NO" (I bet you can figure out what that did!)

frmMain
frmStringing
frmStringingDetails (Not frmStringingDetailsNEW!)

2. Save and close them all in sequence.
3. Open "qryStringReport" in Design View. (Not "qryStringings" or "qryStringReportNew")
4. Scroll over to the Right to the JobID Field and Delete the Criteria, (Do Not Delete the Field, just the Criteria. JobID will be synchronized to the Form)
5. Save and Close.
6. Open "frmStringingDetails" (Not frmStringingDetailsNEW!) in Design View.
7. Open up the code on the "On Click" Event of the "Stringing Report" Button (aka. btnPrint)
8. Delete the entire On Click Procedure (Not the Entire Module, Just the "On Click" Code) and paste this in:

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

    Dim stDocName As String
   
    If Me.One_Piece = True Then
        stDocName = "Stringing_Report1"
    Else
        stDocName = "Stringing_Report2"
    End If
   
    'Saves the Current Record on the Form so that
    'edits on the Form are reflected in the Report
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    'Previews the Report Sychronized to the same Record as the Form
    DoCmd.OpenReport stDocName, acViewPreview, , "[JobID]=[Forms]![frmStringingDetails]![JobID]"

Exit_cmdPrint_Click:
    Exit Sub

Err_cmdPrint_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrint_Click
   
End Sub


9. Click: Debug-->Compile (It will generate an error about "Wrong Number of Arguments"

Replace this line:
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria, , acWindowNormal

With this one:
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria, acWindowNormal
(There was an extra comma)

10. Click: Debug-->Compile, again (This time there should not be any errors)
11.Close Visual Basic
12. Close the Property Box
13. Save and close any open Forms
14. Re-open the Forms in this sequence:

Open "frmMain"
Click the "Stringing" button
Select: Smith, Jo
Click the "Edit" Button
Change "Cross Tension" to    99
Click the "Stringing Report" button
(The Report should now PREVIEW (Note "Cross Tension" should be 99)
Click the Printer Icon form the ToolBar.
The Report SHOULD Print!
Verify that "Cross Tension" is still  99.

I followed these steps twice and it worked both times.
I have two Reports in my hand to prove it!
:)
If this works you will probably have to change any other Forms, Queries or Reports to match the logic I have here.

Let me know ASAP if it works (or not)!
0
 

Author Comment

by:BethWoodhouse
ID: 13975632
Hi boag,
I just lost what I had written to you (I clicked search instead of submit) but basically I just downloaded from the website once again, opened VB and it compiled OK even with that bad instruction line (behind frmPrint which I should delete as it is not needed).

I will try the entire procedure once more as per you instructions, yes,  but I think maybe it is an environmental difference...
If I still get the problem, I will upload to the internet once again.
 
0
 

Author Comment

by:BethWoodhouse
ID: 13975934
Import2.mdb is on the webiste bethwd201.tripod.com
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13980767
Update:
Works at home (Win 2000, Access 2000)

Does NOT work at work (Win XP, Access 2002)

So now the question is: what is the difference?

More importantly: Which one is "Correct"?

I'm at work now, I will load win 2k Off2k and install all windows and Office service packs
I'll do the same with Win xp, Office 2002

And get back to you ASAP
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13993307
Bev,

After a little more reasearch I may have finally resolved this issue:


If you are using Access 2002, set "POP UP" Property of the REPORTS to "NO".

In Access 2002, reports have a "Pop Up" property (But in Access 2000 they do not)

This is why I was able to get it to work at home, but not at work.


If you are using Access 2000, you may have to convert the database to 2002, Set the "Pop up" Property of all the Reports to "No" and Convert the database back to 2000)
(If you leave it as 2002, it cannot be opened with Access 2000 or Access 97)

Let me know if thisd fixes the problem.
I've got my fingers crossed!

:)

(If this works we still have to turn Pop Up off for the reports any way.)

Also you still want to leave the following code before the "DoCmd.OpenReport" line

 
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70


This is because if you make a change in the form (Say, change the cross tension) and click the "Stringing Report" button, the change is not reflected in the Report.



Anyway let me know if this works.


0
 

Author Comment

by:BethWoodhouse
ID: 13995044
Hi boag2000,
Well done!  that simple POPUP property was the problem.  I turned it off and all is well.  And yes I certainly see that I need to save that record before creating the report.  
What a strange thing that a popup property of yes actually made the report do the opposite to popping up but instead it went into the background.
You have worked hard for those points!!
Beth
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 13995395
Yes!

The reason it seemingly works "Backward" is that the print "Process" Looks at the Page Setup options.
If the Report is "Pop-Up" It cannot go into Design View to read the PageSetup options. (So it prints whatever it sees, ex. the Form)
That's how I eventually figured it out. I literally Copied all the report objects and pasted them into a blank Report, and it worked.

The Pop-Up and Modal Properties have been in Access since V.97, but they are new to Reports in 2002.

But before you close this question, TEST IT FULLY, (All the forms, all the Reports) to make SURE it works!

Let me know
:)



0
 

Author Comment

by:BethWoodhouse
ID: 13995680
I have tidied up the original database with all my data etc and removed 2 excess reports.  Both reports set to popup of no and I am saving before printing.  All is working well thanks so I will accept your next message and close, thanks a lot for your patience,
Beth
:)
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 13996278
Glad I could help!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question