I have a function in a form that creats an sql based on the option btn selected. each option builds a unique querydef.
Now I have a report with 10 charts on it, each pointing to the querydef object. I want to set the recordsource/control source/rowsource of all the charts to nothing. Then in a select case, the recordsource or control source or rowsource is set to the querydef or sql created in the form, and visible is T. How do I get this to work?? I don't want to create a report for every chart. I there was a way I could disable all the charts exept the one I want. because all the chgarts are based on the same querydef object, the recordsource of the report is set to that querydef and the rowsource of each chart is different based on the querydef created. Right now each chart is causing errors looking for fields that don't exist in the rowsource exept for the one that matches.
The lines with ERROR are the ones causing trouble.
(form with the optionbtns)
Select Case graphoption
Case 1 'daily sheets
graphSQL = "SELECT ....
graphtitle = "Daily Sheet Percentage of 3/8"
Set graphQD = .CreateQueryDef("Green End graph", graphSQL)
DoCmd.OpenReport "Green End Graph", acViewPreview
(report with charts)
For i = 1 To 4
Me("greenend" & i).Visible = False
Me("greenend" & i).ControlSource = "" ERROR
Select Case graphtitle
Case "Daily sheet percentage of 3/8"
Me("greenend" & 1).ControlSource = green end graph ERROR
Me("greenend" & 1).Visible = True