Good afternoon,
I'm currently new to using Access and VBA. I'm trying to create a form that will include a selecting a month (combo box) to activate my query. I have the SQL statement and the months but I'm having problems getting the connections with the 'Report_Open click statement'. Here is what I have so far:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSql As String
strSql = ""
strSql = strSql & "SELECT dbo_Client.ClientName, dbo_BusinessType.Description, Count(dbo_Client.ClientName) AS [Count]"
strSql = strSql & "FROM (((dbo_Client INNER JOIN dbo_ClientIndicators ON dbo_Client.NationalClientIndicator = dbo_ClientIndicators.NationalClientIndicator) INNER JOIN db
rderRecord ON dbo_Client.ClientID = db
rderRecord.ClientID) INNER JOIN dbo_Product ON db
rderRecord.ProductID = dbo_Product.ProductID) INNER JOIN dbo_BusinessType ON dbo_Product.BusinessType = dbo_BusinessType.BusinessType "
strSql = strSql & "WHERE db
rderRecord.Created between " & Month(Date) - 1 & "/1/" & Year(Date) & " and " & Month(Date) & "/1/" & Year(Date) & " AND dbo_Client.NationalClientIndicator='p' "
strSql = strSql & " GROUP BY dbo_Client.ClientName, dbo_BusinessType.Description;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSql)
Me.frmClient.Form.Recordset = rs
Please Help!!
I'm currently new to using Access and VBA. I'm trying to create a form that will include a selecting a month (combo box) to activate my query. I have the SQL statement and the months but I'm having problems getting the connections with the 'Report_Open click statement'. Here is what I have so far:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSql As String
strSql = ""
strSql = strSql & "SELECT dbo_Client.ClientName, dbo_BusinessType.Description, Count(dbo_Client.ClientName) AS [Count]"
strSql = strSql & "FROM (((dbo_Client INNER JOIN dbo_ClientIndicators ON dbo_Client.NationalClientIndicator = dbo_ClientIndicators.NationalClientIndicator) INNER JOIN db
strSql = strSql & "WHERE db
strSql = strSql & " GROUP BY dbo_Client.ClientName, dbo_BusinessType.Description;"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSql)
Me.frmClient.Form.Recordset = rs
Please Help!!