A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form won't open report from preview button



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2005, 01:35 AM
jwr
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

I created a packing list form that I want to open and open the packing list
report when I select the preview packing list command button on the customer
form. I get the form to open, but I do not get the report behind the print
packing list form to open. What am I missing? Do I need another command to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub


  #2  
Old October 27th, 2005, 03:01 AM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

Yes, each action you want to perform will require a command. You have a
command in the code below to open the form, but nothing to open the report.
The command for that is similar to the one you used to open the form, it is
DoCmd.OpenReport. The default open for a report is to print it, if you want
to preview it be sure to add the acViewPreview argument.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
.. .
I created a packing list form that I want to open and open the packing
list
report when I select the preview packing list command button on the
customer
form. I get the form to open, but I do not get the report behind the
print
packing list form to open. What am I missing? Do I need another command
to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub




  #3  
Old October 27th, 2005, 02:42 PM
jwr
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

I now have the problem of getting the pop-up form to close when the report
appears on the screen. The pop-up form is over the top of the report. How
do I change this?
thanks
"Wayne Morgan" wrote in message
...
Yes, each action you want to perform will require a command. You have a
command in the code below to open the form, but nothing to open the

report.
The command for that is similar to the one you used to open the form, it

is
DoCmd.OpenReport. The default open for a report is to print it, if you

want
to preview it be sure to add the acViewPreview argument.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
.. .
I created a packing list form that I want to open and open the packing
list
report when I select the preview packing list command button on the
customer
form. I get the form to open, but I do not get the report behind the
print
packing list form to open. What am I missing? Do I need another

command
to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview

Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub






  #4  
Old October 27th, 2005, 09:06 PM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

Are you using the popup form as a data or filter source for your report? If
so, you probably don't want to close it until you close the report. However,
you can hide it by setting its Visible property to False. Use the IsLoaded()
function that you are currently using in the 2nd event you published in your
report's Close event to see if the popup form is still open. If it is, close
it using the DoCmd.Close command.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
. ..
I now have the problem of getting the pop-up form to close when the report
appears on the screen. The pop-up form is over the top of the report.
How
do I change this?
thanks
"Wayne Morgan" wrote in
message
...
Yes, each action you want to perform will require a command. You have a
command in the code below to open the form, but nothing to open the

report.
The command for that is similar to the one you used to open the form, it

is
DoCmd.OpenReport. The default open for a report is to print it, if you

want
to preview it be sure to add the acViewPreview argument.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
.. .
I created a packing list form that I want to open and open the packing
list
report when I select the preview packing list command button on the
customer
form. I get the form to open, but I do not get the report behind the
print
packing list form to open. What am I missing? Do I need another

command
to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview

Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub








  #5  
Old October 28th, 2005, 12:47 AM
jwr
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

Let me try again. Below is the code behind my pop-up form "Print Packing
List".

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False

End Sub

Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
Me.Visible = False
End Sub



This is the code behind the "Preview (command button) Packing List" at the
bottom of the pop-up form above.

This form is used as a filter source for my report.

I have Visible = false already.



I want the pop-up form to open when I select the Preview command button on
the bottom of my Orders by Customer form. Code follows:

Private Sub Command38Preview_Packing_List_Click()
On Error GoTo Err_Command38Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Print Packing List"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command38Preview_Packing_List_Click:
Exit Sub

Err_Command38Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Command38Preview_Packing_List_Click

End Sub


When I select the Preview Packing List command button on the "Orders by
Customers", this information should be for the customer ONLY and no others.
The pop-up form appears, I click the preview button, and the report appears
behind the pop-up form. When I close the pop-up form, I get a "bug" error,
I close that error message, close my orders form and the packing list form
is still on the screen.

Maybe I have too many commands, such as preview on the pop-up form and
preview on the orders by customers. I want the Orders by Customers form to
be the place for the preview option.

Hopefully you can follow me on this. I am relatively new to code such as
this and I may not be understanding your reply.
Thank you for your assistance.
JR
__________________________________________________ __________________________
_____________________________________________










Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String

stDocName = "Packing List"
DoCmd.OpenReport stDocName, acPreview

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub
"Wayne Morgan" wrote in message
...
Are you using the popup form as a data or filter source for your report?

If
so, you probably don't want to close it until you close the report.

However,
you can hide it by setting its Visible property to False. Use the

IsLoaded()
function that you are currently using in the 2nd event you published in

your
report's Close event to see if the popup form is still open. If it is,

close
it using the DoCmd.Close command.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
. ..
I now have the problem of getting the pop-up form to close when the

report
appears on the screen. The pop-up form is over the top of the report.
How
do I change this?
thanks
"Wayne Morgan" wrote in
message
...
Yes, each action you want to perform will require a command. You have a
command in the code below to open the form, but nothing to open the

report.
The command for that is similar to the one you used to open the form,

it
is
DoCmd.OpenReport. The default open for a report is to print it, if you

want
to preview it be sure to add the acViewPreview argument.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
.. .
I created a packing list form that I want to open and open the

packing
list
report when I select the preview packing list command button on the
customer
form. I get the form to open, but I do not get the report behind the
print
packing list form to open. What am I missing? Do I need another

command
to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview

Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub










  #6  
Old October 29th, 2005, 04:53 PM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default Form won't open report from preview button

In the button where you open the report from the popup form, you need to
hide the popup form. You are hiding it in the Cancel button's event if you
choose to not open the report and also in the Ok button's click event, but
the Ok button doesn't open the report (i.e. no DoCmd.OpenReport command).
How are you opening the report? Also, in the Cancel button, I would probably
close the popup instead of hiding it unless you have another need for it.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
...
Let me try again. Below is the code behind my pop-up form "Print Packing
List".

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False

End Sub

Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
Me.Visible = False
End Sub



This is the code behind the "Preview (command button) Packing List" at the
bottom of the pop-up form above.

This form is used as a filter source for my report.

I have Visible = false already.



I want the pop-up form to open when I select the Preview command button on
the bottom of my Orders by Customer form. Code follows:

Private Sub Command38Preview_Packing_List_Click()
On Error GoTo Err_Command38Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Print Packing List"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command38Preview_Packing_List_Click:
Exit Sub

Err_Command38Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Command38Preview_Packing_List_Click

End Sub


When I select the Preview Packing List command button on the "Orders by
Customers", this information should be for the customer ONLY and no
others.
The pop-up form appears, I click the preview button, and the report
appears
behind the pop-up form. When I close the pop-up form, I get a "bug"
error,
I close that error message, close my orders form and the packing list form
is still on the screen.

Maybe I have too many commands, such as preview on the pop-up form and
preview on the orders by customers. I want the Orders by Customers form
to
be the place for the preview option.

Hopefully you can follow me on this. I am relatively new to code such as
this and I may not be understanding your reply.
Thank you for your assistance.
JR
__________________________________________________ __________________________
_____________________________________________










Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String

stDocName = "Packing List"
DoCmd.OpenReport stDocName, acPreview

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub
"Wayne Morgan" wrote in
message
...
Are you using the popup form as a data or filter source for your report?

If
so, you probably don't want to close it until you close the report.

However,
you can hide it by setting its Visible property to False. Use the

IsLoaded()
function that you are currently using in the 2nd event you published in

your
report's Close event to see if the popup form is still open. If it is,

close
it using the DoCmd.Close command.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
. ..
I now have the problem of getting the pop-up form to close when the

report
appears on the screen. The pop-up form is over the top of the report.
How
do I change this?
thanks
"Wayne Morgan" wrote in
message
...
Yes, each action you want to perform will require a command. You have
a
command in the code below to open the form, but nothing to open the
report.
The command for that is similar to the one you used to open the form,

it
is
DoCmd.OpenReport. The default open for a report is to print it, if you
want
to preview it be sure to add the acViewPreview argument.

--
Wayne Morgan
MS Access MVP


"jwr" wrote in message
.. .
I created a packing list form that I want to open and open the

packing
list
report when I select the preview packing list command button on the
customer
form. I get the form to open, but I do not get the report behind
the
print
packing list form to open. What am I missing? Do I need another
command
to
open the Packing List Report? thanks in advance, JR



CODE BEHIND "PREVIEW PACKING LIST" ON ORDERS BY CUSTOMER FORM:

Private Sub Preview_Packing_List_Click()
On Error GoTo Err_Preview_Packing_List_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Preview_Packing_List_Click:
Exit Sub

Err_Preview_Packing_List_Click:
MsgBox Err.Description
Resume Exit_Preview_Packing_List_Click

End Sub




CODE BEHIND "PRINT PACKING LIST FORM"

Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Print Packing List form using the Preview
Packing
List button on the Orders by Customer form."
Cancel = True
End If
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
Private Sub Cancel_Click()
DoCmd.Close acForm, "Print Packing List"
End Sub












 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
open and filter report from command button in form daveyboy300 General Discussion 1 August 30th, 2005 03:44 AM
Requerying a pop up form to display in the main form Jennifer P Using Forms 13 April 5th, 2005 06:59 PM
Help!! I'm running around in circles! CathyA New Users 19 December 12th, 2004 07:50 PM
Dynamic Page Margins Vel Setting Up & Running Reports 6 September 19th, 2004 09:46 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM


All times are GMT +1. The time now is 12:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.