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

Double Click event in a list box to open a report

Status
Not open for further replies.

bgibsonIYD

Technical User
Jun 18, 2001
28
US
I have a form, with a tab control on it with 4 tabs (Lists, Labels, Communities, Other). On each of those tabs I have a list box. In the row source of the list box I have the following Code (this one is for the tab called "Lists". All the reports I have begin with 3 letters according to how they are categorized to go into the tabs-lst="Lists", lbl="Labels", cmty="Communities", and otr=Other":

SELECT Right([name],Len([Name])-3) AS NameWithoutList FROM msysobjects WHERE ((([msysobjects].[Type])=-32764) And ((Left([name],3))="lst"));

This was to pull all the reports that have the three letter code "lst" in front.

Now I would like to put an event procedure on the double click proptery to open the report when I double click on the selection in the box. My problem is that each time I try to put in any code, it debugs because of the preceding 3 or 4 letter is not in the list box. (lst, lbl, cmty, or otr).

Can someone help me with some code to be able to double click on a selection in the list box to preview the report?

Beth
**Learning Access**
 
need to also select name into the combobox

SELECT Right([name],Len([Name])-3) AS NameWithoutList, [name] FROM msysobjects WHERE ((([msysobjects].[Type])=-32764) And ((Left([name],3))="lst"));

then refer to it as me.list1[column](1) it will then return the name of the report which is held in column 2
it wont show up in the list unless you change the column count
then
remember the colunms are numbered starting with zero

dim rptname as string
rptname = me.list1.[column](1)

docmd.openreport rptname,,,,'what ever params you want

the tabs may change how it needs to be called but I dont think so.

Make sure you refer to the listbox by the name you called it I just said list1
good luck
 
This was GREAT!!! It worked perfectly! Thank's for the help!

Beth
**Learning Access**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top