No, not in the <>_Open event, I dont think so here.
Let me just take a stab at what you've included her.
First of all. The approach I'd use is to create the QueryDef for each of the five Surveys, which will become the data source for the report. This is the code that will be used to create the queries themselves, Place this in a Code Module and use, "Call CreateDataSources", prior to Creating the report.
Public Sub CreateDataSources()
Dim db as database
Dim qd as QueryDef
set db = DBENGINE(0)(0)
On Error Resume Next
db.QueryDefs.Delete "Query1"
db.QueryDefs.Delete "Query2"
db.QueryDefs.Delete "Query3"
db.QueryDefs.Delete "Query4"
db.QueryDefs.Delete "Query5"
On Error Goto 0
set qd = db.CreateQueryDef("Query1", "SELECT Count(*) as [Respondents],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey1]"
set qd = db.CreateQueryDef("Query2", "SELECT Count(*) as [Respondents],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey2]"
set qd = db.CreateQueryDef("Query3", "SELECT Count(*) as [Respondents],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey3]"
set qd = db.CreateQueryDef("Query4", "SELECT Count(*) as [Respondents],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey4]"
set qd = db.CreateQueryDef("Query5", "SELECT Count(*) as [Respondents],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey5]"
End Sub
.. remember, approach is the key. This code allows you to keep all the the development problems in a single function call. From here you can modify the Five (5) queries to suit your needs. Then update the report layout, if necessary,
after, you have data the way that you want it.
If each survey needs to be broken down by zip code then add
a, "... Group By [Zipcode] Order By [Zipcode]", clause to the SQL statement(s).
as in...,
"SELECT Count([ZipCode]) as [Respondants],Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey1] ORDER BY [ZipCode] Group By [ZipCode]"
.. or
"SELECT Count([ZipCode]) as [Respondants],First([ZipCode]) as [ZipCode], Sum(Abs([YesNoField] + 1)) as [AnsweredNO], Sum(Abs([YesNoField1])) as [AnsweredYES] From [tableSurvey1] ORDER BY [ZipCode] Group By [ZipCode]" [/b]
I think this is correct. Use the Function above, replace the necessary table names and field names in teh queries and execute the function call, then afterword execute the queries, and check the results. You'll end up playing with the queries themselves to get the data right. But this approach should make it easier to get the job done.
Let me know.