If you want to learn more about SQL and if you can be in Richmond on January 30th, SQL Saturday is the place to be.
Hope to see you there!
A technical blog about my projects, challenges, and discoveries in the world of data warehousing using SQL Server, Power BI Desktop, DevExpress, and more.
Sub OnBeforePrint
rpt.lblContinued.Visible = Not Eval("rpt.ctlCurrentPage.DataValue = rpt.ctlTotalPages.DataValue")
End Subselect NameCounter = n.NameCounter, Age = datediff(year, n.Birthdate, getdate())from Shelby.NANames as nselect NameCounter = n.NameCounter, Age = datediff(year, n.Birthdate, getdate()) - case when month(n.Birthdate) > month(getdate()) then 1 else 0 endfrom Shelby.NANames as nselect NameCounter = n.NameCounter, Age = datediff(year, n.Birthdate, getdate()) - case when month(n.Birthdate) > month(getdate()) or (month(n.Birthdate) = month(getdate()) and day(n.Birthdate) > day(getdate())) then 1 else 0 endfrom Shelby.NANames as nselect NameCounter = n.NameCounter, Age = case when year(n.Birthdate) = 1796 then null else datediff(year, n.Birthdate, getdate()) - case when month(n.Birthdate) > month(getdate()) or (month(n.Birthdate) = month(getdate()) and day(n.Birthdate) > day(getdate())) then 1 else 0 end endfrom Shelby.NANames as n objValue = rpt.Sections("Detail").Controls.Item("Field1") objValue = rpt.Sections("Detail").Controls.Item("Field1").DataValueSub OnReportStart
Set oDict = CreateObject("Scripting.Dictionary") Set rsQuery = rpt.DataSource_Shelby_.RecordSet
If rpt.DataSource_Shelby_.RecordSet.RecordCount > 0 Then
intCounter = 1 strCurrItem = "" strTestItem = "" strColumnName = "QueryColumnName" strPromptMessage = "Enter the prompt message here." strPromptTitle = "Enter the Prompt Title here"
Do strCurrItem = rsQuery(strColumnName) If strCurrItem <> strTestItem Then oDict.Add intCounter, strCurrItem strList = strList & vbCR & intCounter & " - " & strCurrItem strTestItem = strCurrItem intCounter = intCounter + 1 End If rsQuery.MoveNext Loop Until rsQuery.EOF
Do intChoice = InputBox(strPromptMessage & vbCr & strList, strPromptTitle) If intChoice <> "" and IsNumeric(intChoice) Then strItemChoice = oDict.Item(CInt(intChoice)) rsQuery.Filter = strColumnName & " = '" & strItemChoice & "'" If rsQuery.RecordCount > 0 Then Exit Do Else rsQuery.Filter = "" End If If intChoice = "" Then Exit Do Loop
rsQuery.MoveFirst
Else
MsgBox("There are no results to use for this report. Please check the query and try again after you have a set of results.")
End If
End Sub