List Box in a Dialog Form

  • Thread starter Thread starter S Jackson
  • Start date Start date
S

S Jackson

I have created a dialog form containing a list box named RptListBox.
The list box is from tblReports which contains 2 fields: RptName and
ActualName.

RptName is a user-friendly name for the report
ActualName is the actual name of the report in the db.

I want a cmd button that the user will click after they select a report that
will preview the report.

I've tried this (per someone else's advice here):

DoCmd.OpenReport RptListBox, acPreview

The error is: The expression you entered is the wrong data type for one of
the arguments.

I know I need to set some sort of variable, but I'm just learning and don't
know how.

TIA
S. Jackson
 
Hi,
Is your listbox set up so that your 1st column contains the ActualName, is the bound column
and hidden? I would think it would work if set up this way.
 
The Actual report name should be the first column. If you wish, you can set
the length of the first column in the listbox to 0, and it will not show.

Also make sure that properties sheet for the list box has the bound column
set to 1 if you choose the above approach.

You code looks ok...

DoCmd.OpenReport RptListBox, acPreview

Also, is the listbox un-bound (it should be).
 
Back
Top