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

form to report gets lost

Status
Not open for further replies.

newnoviceuser

Programmer
Jan 4, 2003
63
US
trying to print a report added the following code on event open
Private Sub Report_Open(Cancel As Integer)
If Forms![frmloaninquiry]![txtyear] > "1800" Then
Label274.Visible = False
Label233.Visible = True
Else
Label274.Visible = True
Label233.Visible = False
End If
End Sub

now it doesnt print or close the form its like it gets lost
 
need to add that if the program is run from a different form it is operating properly wonder if it might be a focus problem the form i am getting the data from is not the form that activates the report but it is open
 
Print or close" what form? There is no code or other method posted that mentions anything about printing or closing a form.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Call SetReportMarginDefault("ContractInstallments", 0.25, 0.25, 0.25, 0.25)
DoCmd.OpenReport "ContractInstallments"
DoCmd.OpenReport "ContractInstallments"

is in a form called loandetail

the command posted earlier is in the report
 
I'm still confused. Couple suggestions:
[li]Code to set property values in reports should reside in the On Format event of the section containing the controls[/li]
[li]Give your controls decent names so that your code is understandable. "Label274" is not a good name for a control [/li]
[li]frmloaninquiry must be open when your report is opened[/li]
[li]Your most recent code prints two copies of the report[/li]
[li]Is your txtYear numeric or text? Your code suggests it is text.[/li]
[li]I still don't know what you thought you were closing[/li]




Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
ok here goes I have a form called frmloaninquiry when you choose the right customer it open a form called loan detail this form has a cmd button called print it prints the contract twice original and copy then closes both forms. before i put the above posted if statement in it worked perfectly. 2ndly on the loaninquiry form there is a reprint contract button. this button works perfectly. the command in this button is the same as the other. hope im clear enough for you.
 
Place the code in the On Format event of the section containing the controls. Also, is there any code that closes the form "frmloaninquiry"?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top