Here i came with another query,
I am trying to export the report based on combo selection of
cboEmpID
cboCatagory
cboReportName
After all this are selected on frmExtIndividualRpts than only this command button should work and export the report based on the same name of report saved in
[tblReports]![ReportLocation]
Since i have more than 100 reports, i can't mention all this names in coding hence i have made a table called tblReports which has same report name saved in field [Reportlocation] i just need to call that field to export it as per the selection of category and Reportname selected on form.
I have manage to code the below, but not sure what is wrong with it, also its given me a message of "Data type mismatch"
[RID] is Number field and PK
[ReportName] is text field (Same data is saved as in cboReportName)
[ReportLocation] is the field which is having report real name cboReportName is just for non programming user's just not to confuse them self with short names of report.
I am trying to export the report based on combo selection of
cboEmpID
cboCatagory
cboReportName
After all this are selected on frmExtIndividualRpts than only this command button should work and export the report based on the same name of report saved in
[tblReports]![ReportLocation]
Since i have more than 100 reports, i can't mention all this names in coding hence i have made a table called tblReports which has same report name saved in field [Reportlocation] i just need to call that field to export it as per the selection of category and Reportname selected on form.
I have manage to code the below, but not sure what is wrong with it, also its given me a message of "Data type mismatch"
[RID] is Number field and PK
[ReportName] is text field (Same data is saved as in cboReportName)
[ReportLocation] is the field which is having report real name cboReportName is just for non programming user's just not to confuse them self with short names of report.
Code:
Private Sub btnExportToPDF_Click()
On Error GoTo errhandlers:
If IsNull(cboEmpId_RC) Or IsNull(cboReportCatagory) Or IsNull(cboReportName) = "" Then
MsgBox "Please Select all required fields to proceed further for export. !"
Exit Sub
End If
If Not IsNull(cboReportName) Then
Me.cboReportName.Value = DLookup("[ReportName]", "[tblReports]", "[RID]='" & [cboReportName] & "'")
DoCmd.OutputTo acOutputReport, "tblReports", "[ReportLocation]", acFormatPDF
End If
Exit Sub
errhandlers:
MsgBox Err.Description, , Err
End Sub
Last edited: