Excel_Kid1081
Registered User.
- Local time
- Today, 11:08
- Joined
- Jun 24, 2008
- Messages
- 34
Hello-
I have two questions that pertain to the end product I would like to achieve. I am basically creating a reporting DB that will have between 15-20 different reports in it. However, the data feeding the reports requires a few different sub queries to be created before the final output.
Question #1: Are using QueryDefs and then deleting the saved query objects after the report is completed and printed the best way to do it if I want to have all of them not visible to the user?
Question #2: I have created this UNION QueryDef and I am having some trouble debugging it. All the suporting queries were run successfully and I can see their objects in the Queries under the DB Objects and they work fine.
Sub Create_UnionCreditWts_CrossTab()
Dim db As DAO.Database
Set db = CurrentDb
Dim qd As DAO.QueryDef
Dim strSQL As String
Dim QryDefName As String
'Name the UNION Query
QryDefName = "qryReport_Index_Credit_Weights"
strSQL = "SELECT * FROM Index_CreditWts_A UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_AA UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_AAA UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_BBB UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_OTHER " & _
strSQL = strSQL & "ORDER BY RatingOrder;"
Set qd = db.CreateQueryDef(QryDefName, strSQL)
qd.Close
Set db = Nothing
MsgBox "done"
End Sub
Thanks!!
I have two questions that pertain to the end product I would like to achieve. I am basically creating a reporting DB that will have between 15-20 different reports in it. However, the data feeding the reports requires a few different sub queries to be created before the final output.
Question #1: Are using QueryDefs and then deleting the saved query objects after the report is completed and printed the best way to do it if I want to have all of them not visible to the user?
Question #2: I have created this UNION QueryDef and I am having some trouble debugging it. All the suporting queries were run successfully and I can see their objects in the Queries under the DB Objects and they work fine.
Sub Create_UnionCreditWts_CrossTab()
Dim db As DAO.Database
Set db = CurrentDb
Dim qd As DAO.QueryDef
Dim strSQL As String
Dim QryDefName As String
'Name the UNION Query
QryDefName = "qryReport_Index_Credit_Weights"
strSQL = "SELECT * FROM Index_CreditWts_A UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_AA UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_AAA UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_BBB UNION ALL " & _
strSQL = strSQL & "SELECT * FROM Index_CreditWts_OTHER " & _
strSQL = strSQL & "ORDER BY RatingOrder;"
Set qd = db.CreateQueryDef(QryDefName, strSQL)
qd.Close
Set db = Nothing
MsgBox "done"
End Sub
Thanks!!