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

opening a report

Status
Not open for further replies.

RufussMcGee

Technical User
Jan 7, 2005
117
0
0
US
Need help on the VB side of things. What I have is a text box on my form name txtBegin and another txtEnd, they are combine in a text box called txtCombine. The txtCombine is actually the name of a report to be opened there are different combo that user can choice from. Having trouble getting VB to use the txtCombine value as the report name.

Thanks
 
How many columns has txtCombine? If it is more than one, you may beed to reference the column property:

Me.txtCombine.Column(1)

For example, where column number starts from zero. Other than that, you can step through the code and give a more exact account of the problem.

 
How are ya RufussMcGee . . .

You didn't say how you intend to trigger opening the report, but the line to open the report would be something like:
Code:
[blue]   DoCmd.OpenReport Me!txtCombine, acViewPreview[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
This is the code....

Option Compare Database
Dim abc As String

Private Sub btnCombine_Click()
On Error GoTo btnCombine_Click_Err


abc = Forms!Form1!TxtBegin + Forms!Form1!txtEnd
Forms!Form1!txtAnswer = abc
'DoCmd.OpenReport Me!txtAnswer, acViewNormal, "", "", acNormal
'DoCmd.OpenReport Me!txtAnswer, acViewPreview
DoCmd.OpenReport Me!TxtBegin, acViewPreview

btnCombine_Click_Exit:
Exit Sub

btnCombine_Click_Err:
MsgBox Error$
Resume btnCombine_Click_Exit

End Sub

This is what I get back....
'The OpenReport action was canceled'

What I am trying to do is off one form page type letter a through e and number 1 through 5 and that will recieve the correct report
 
Have you tried:

DoCmd.OpenReport abc, acViewPreview

And to be sure that the report works:

DoCmd.OpenReport "a5", acViewPreview

It is often a good idea to put in something that shows what is happening. Debug.Print is usual, it will write to the immediate window, but you can also use a messagebox:

Code:
MsgBox "Report name: " & abc    
DoCmd.OpenReport abc, acViewPreview


 
Thank you all for the Answers.

The problem was opening the report my default printer in a Wide Format 36" wide x upto 500 feet thus access does not like that paper that was selected (Arch D 24"x36").

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top