P
Pat Coleman
Newbie Form / Report using code Question
I am tring to generate a form with two combo boxes, using a 'Value List' as
the source type and manually entered values as the row source.
I also want a button called Preview which when pressed will preview a report
( called report01 ) based on the selection in the two combo boxes.
I want to stick to CODE only , as opposed to writing a query or using a
macro
So Far I have
Cmb01 will have 3 values "Distribuor"; "Wholesale"; "Retail"
Cmb02 will have 3 values "EastCoast" " MidWest" "WestCoast"
And the preview button.
The report - report01, is pulled from a customer table which includes two
fields called
1) 'Type' which is either Distributor, Wholesale or Retail.
2) 'Area' which is either EastCoast, MidWest or WestCoast
The question are
1. What is the code, if any is required, for the combo boxes to capture the
choice of values picked by the user and where to I paste this code in the
combo box.
2. What would be the corresponding code for the preview button to capture
the values of the Combo Box and pass it through to the Report.
I assume I paste this code in the 'OnClick' field of the Event Tab in the
properties of the Preview button.
I am thinking the preview code will be something like
DoCmd.OpenReport "report01", acPreview, "[Type] = Cmb01 AND [Area] =
Cmb02"
I know the above line of code has errors in it but I cant figure out the
right code for my little project.
Any help appreciated.
I am tring to generate a form with two combo boxes, using a 'Value List' as
the source type and manually entered values as the row source.
I also want a button called Preview which when pressed will preview a report
( called report01 ) based on the selection in the two combo boxes.
I want to stick to CODE only , as opposed to writing a query or using a
macro
So Far I have
Cmb01 will have 3 values "Distribuor"; "Wholesale"; "Retail"
Cmb02 will have 3 values "EastCoast" " MidWest" "WestCoast"
And the preview button.
The report - report01, is pulled from a customer table which includes two
fields called
1) 'Type' which is either Distributor, Wholesale or Retail.
2) 'Area' which is either EastCoast, MidWest or WestCoast
The question are
1. What is the code, if any is required, for the combo boxes to capture the
choice of values picked by the user and where to I paste this code in the
combo box.
2. What would be the corresponding code for the preview button to capture
the values of the Combo Box and pass it through to the Report.
I assume I paste this code in the 'OnClick' field of the Event Tab in the
properties of the Preview button.
I am thinking the preview code will be something like
DoCmd.OpenReport "report01", acPreview, "[Type] = Cmb01 AND [Area] =
Cmb02"
I know the above line of code has errors in it but I cant figure out the
right code for my little project.
Any help appreciated.