Hi,
This is my first attempt at select case etc.
I have a form with various controls to set values for year, month, quarter, filter, info by.
The data comes from a query named "qrydiscanalysis"
I have Dim both ReportName and Albums as Strings
There are a total of 3 Cases, Year, Quarter and Month
Case 1 is:-
Case ByYear
strReportName = "Yearly Album Report"
Albums = DLookupStringWrapper("AlbumName", "qryDiscAnalysis", "[Year]=" & Me.cbYear)
Ater which The various diferent object variables for the report are added:-
If Albums <> "" Then
TempVars.Add "Group By", Me.lstAlbumReports.Value
TempVars.Add "Display", DLookupStringWrapper("[Display]", "Album Reports", "[Group By]='" & Nz(Me.lstAlbumReports) & "'")
TempVars.Add "Year", Me.cbYear.Value
TempVars.Add "Quarter", Me.cbQuarter.Value
TempVars.Add "Month", Me.cbMonth.Value
DoCmd.OpenReport strReportName, ReportView, , strReportFilter, acWindowNormal
End If
I get an error message
" Run-yime error 3131
Syntax error in From Clause"
I want to use Dlookup and not a query but I need a bit of help to show me where I am going wrong. Thanks
This is my first attempt at select case etc.
I have a form with various controls to set values for year, month, quarter, filter, info by.
The data comes from a query named "qrydiscanalysis"
I have Dim both ReportName and Albums as Strings
There are a total of 3 Cases, Year, Quarter and Month
Case 1 is:-
Case ByYear
strReportName = "Yearly Album Report"
Albums = DLookupStringWrapper("AlbumName", "qryDiscAnalysis", "[Year]=" & Me.cbYear)
Ater which The various diferent object variables for the report are added:-
If Albums <> "" Then
TempVars.Add "Group By", Me.lstAlbumReports.Value
TempVars.Add "Display", DLookupStringWrapper("[Display]", "Album Reports", "[Group By]='" & Nz(Me.lstAlbumReports) & "'")
TempVars.Add "Year", Me.cbYear.Value
TempVars.Add "Quarter", Me.cbQuarter.Value
TempVars.Add "Month", Me.cbMonth.Value
DoCmd.OpenReport strReportName, ReportView, , strReportFilter, acWindowNormal
End If
I get an error message
" Run-yime error 3131
Syntax error in From Clause"
I want to use Dlookup and not a query but I need a bit of help to show me where I am going wrong. Thanks