Another Combo Box Problem

fulltime

Registered User.
Local time
Tomorrow, 05:37
Joined
Mar 24, 2006
Messages
56
Hi all,

i have got 2 questions here :

1.
When i click on the dropdown list, i am able to select the listed options, but how do i DISallow the user from entering text into the combo box? I do not wan the user to edit the text in the combo box. thks..

2.
After selecting an option in the combo box, for eg, the user selects the second option, i want to open a form with the same name as the second option. how can i go about achieving it?

Thks alot
FT:)
 
1.
When i click on the dropdown list, i am able to select the listed options, but how do i DISallow the user from entering text into the combo box? I do not wan the user to edit the text in the combo box. thks..
If you installed the combo with the default settings then the users can't edit delete or add to the combo box (Limit to List = Yes)

2.
After selecting an option in the combo box, for eg, the user selects the second option, i want to open a form with the same name as the second option. how can i go about achieving it?
Create a table with 3 fields

ReportListID (AutoNumber & PK)
FNameofReport (This is a friendly name that the user will see (e.g. Invoice)
NameOfReport (this is the name of the report (e.g rptInvoice)

Save the table with the name tblReportList
Enter into this table the name of your report as show in access
and in the FNameofReport enter a friendly name.

Now put the combo on the form using the wizard and then use the table as the row source. Let the wizard hide the Primary Key (ReportListID)
Open the combo box in design view and go to Format / Column Widths change it to 0;1.0";0 (the 1" should fit the Friendly report name if not change it). .This hide the primary key and the name of the report shown in access.Next change the name of the combo to cboReportList. Now close and save the form and view the list in the combo box and you should see the friendly names of the reports.

You can put this code behind a command button or in the after update event of the combo box let go for the command button.

Put a command button on your form and name it cmdPreviewReport

Put this code in the on click event of cmdPreviewReport


Code:
On Error GoTo Err_cmdPreviewReport_Click

    Dim stDocName As String
    

    stDocName = cboReportList.Column(2)
        
    DoCmd.OpenReport stDocName, acPreview

Exit_cmdPreviewReport_Click:
    Exit Sub

Err_cmdPreviewReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdPreviewReport_Click

This should work for you, if you have a large number of report to add to the table post back and I will give you the SQL for a query that will list all the reports in the database.
 
wow, tats a very detailed solution, john.. thks alot.. i will go give it a try.. thks agn

FT:)
 

Users who are viewing this thread

Back
Top Bottom