I use a table of reports to be able to select the right report.
In the table i have the fields;
ID_rap
Rap_naam - the name the user will see in the cmb_rapselect
Rap_cat - category of the report
Rap_rapselect - the real name of the report (the name i have to use if i want the report to show
I made a Query called Q_raps which lists all fields of the table.
On a form i have 2 comboboxes;
cmb_rapcat
cmb_rap_rapselect
The first combo lists the categories from the Qyery. Works fine
The second combo the lists all reports from the category choosen in the first combo. The list consists of the names that the user sees, not the actual name of the report which is in the field [rap_nameselect]
I now have a button on the form which, when clicked, should produce the report based on the report selected in the combo cmb_rapselect]. However, if i do that it will say that there is no report with that name.
The code for the button;
Expand|Select|Wrap|Line Numbers
- Private Sub but_rapprint_Click()
- Dim strQL As String
- Dim rapsel As String
- strSQL = "SELECT * FROM Q_raps "
- strSQL = strSQL & "WHERE [Rap_naam] = me.[cmb_rap_rapselect]"
- rapsel = [Rap_select]
- DoCmd.OpenReport rapsel, acViewReport
- End Sub
How can i make the button look at the right field called [Rap_select]?
Help would be much appreciated.
Thanks in advance.
Pierkes