I'm new to Access. I saw this done in a class last month, but it was done with the expression builder, I think. It was not done with Code (this was only a level 2 Access class offered at work)
I am trying to produce a individual employee data report. The report I built originally processed all 67 records. I then added a filter in the report
[ccn]=[Enter CCN ID]
and got the results I wanted an employee data report on one individual.
But, I want to select from a dropdown list, not have to type in the record ID that I want. So I created a form with a combobox and command button. I've tried it with the expression builder, I've tried it with the macro builder, now I'm trying it with code. I've received results ranging from producing a single record report with errors in every field to all 67 records in one report with all of the data correct.
Option Compare Database
Private Sub cboCCN_AfterUpdate()
Private Sub cmdProcessCMO_Click()
On Error Resume Next
'User must select a value from the combo box
If IsNull(cboCCN) = True Then
MsgBox "You must select a Employee Number."
'Open report called rptCMO for the CCN selected
DoCmd.OpenReport "rptCMO", acViewPreview, , "CCN = cboCCN"
the field the report looks to to populate is [CCN]
The code above produces a single record report, but still prompts me to enter the CCN