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!

Open report w/ combo box

Status
Not open for further replies.

onefootout

Technical User
Oct 23, 2007
42
US
Hi All,

I'm trying to open a report chosen from a combo box when the user clicks a button.

I have a table with 2 columns, the display name for a report, and the actual name.

I created a combo box with this info, set the column property for column 2 (actual report name) to 0, and made a button with the below onclick event. When I test it, I get an "Invalid use of Null" error. I can't figure out what I'm doing wrong here!

Thanks in advance for any help!


Code:
Private Sub viewreport_Click()

Dim strDocName As String

Let strDocName = Me!pickrpt.Column(2)

DoCmd.OpenReport strDocName, acPreview

End Sub
 
You may try this:
Code:
Private Sub viewreport_Click()
DoCmd.OpenReport Me!pickrpt.Column([!]1[/!]), acViewPreview
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Columns start numbering from zero. The value of a combo is the value of the default column. Things fall apart if you do not have a correct column count.
 
Huh. That worked, but I don't understand why.

Does it count columns from right to left?
 
Does it count columns from right to left
No.
tip: put the cursor inside the Columns word in your code and then press the F1 key.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top