I just need a bit of help in VBA.
What I'm trying to do is to open report from a form. The reports are based on Query.
The form consists of a combo box and a command button. What I want to do is to select the condition of opening the report from combo box and open that report.
Following is the code I'm using
1) Dealer = Form!DEALER_COMBO.Value
2) DoCmd.OpenReport "SALES REPORT", acViewPreview, , "[OKCUNM] = 'BATALION MOTORS'"
Text9.Text = Me.DEALER_COMBO.Value
4)DoCmd.OpenReport "SALES REPORT", acViewPreview, , "[OKCUNM]" = Form!DEALER_COMBO.Value
The second and third lines of code are just tests. OKCUNM is a field on the report which is running on a query.
If I comment line 4 everything works fine with the set condition in line 2, but I want the condition to be fulfilled by combo box which I'm trying to do in line 4.
In line 4 the value from Form!DEALER_COMBO.Value is not getting stored in OKCUNM