Hi All,
I'm creating a small database at work (Access 2000) and want to provide a report function with the option of chooosing multiple criteria. Now, i've done this before on a much larger database, and had absolutely zero problems, but on this database there is one criteria selection which causes zero records to be returned
So, the data all comes from 1 table, tbl_Servers. There are 5 fields -
Server_name (text)
Start_time (short time)
End_Time (short time)
Reboot_Method (text)
Day (text)
I can get the query to work for Server_Name, Start_Time, End_Time and Day, or any combination thereof, but as soon as I enter a Reboot_Method, I get zero records returned.
The options for Reboot_Method are all taken from the table, using a Select Distinct statement, and are as follows:
Auto
DailyScheduledReboot
Manual
The code I am using is as follows, but can anyone explain why the Reboot_Method part isn't working??
And yes, I know I should change the names of the combo boxes to something more meaningful, but at the moment i'm just trying to get the above to work for Reboot_method!!
Many thanks in advance!
Chris
I'm creating a small database at work (Access 2000) and want to provide a report function with the option of chooosing multiple criteria. Now, i've done this before on a much larger database, and had absolutely zero problems, but on this database there is one criteria selection which causes zero records to be returned

So, the data all comes from 1 table, tbl_Servers. There are 5 fields -
Server_name (text)
Start_time (short time)
End_Time (short time)
Reboot_Method (text)
Day (text)
I can get the query to work for Server_Name, Start_Time, End_Time and Day, or any combination thereof, but as soon as I enter a Reboot_Method, I get zero records returned.
The options for Reboot_Method are all taken from the table, using a Select Distinct statement, and are as follows:
Auto
DailyScheduledReboot
Manual
The code I am using is as follows, but can anyone explain why the Reboot_Method part isn't working??
Code:
Dim strWhere As String
Dim stDocName As String
Dim blnTrim As Boolean
'if Owner
If Not IsNull(Me.Combo15) Then
strWhere = strWhere & "tbl_servers.[owner]= '" & Me.Combo15 & "' And "
blnTrim = True
End If
'If Start Time
If Not IsNull(Me.Combo5) Then
strWhere = strWhere & "tbl_servers.[start_time]= #" & Me.Combo5 & "# And "
blnTrim = True
End If
'If End Time
If Not IsNull(Me.Combo7) Then
strWhere = strWhere & "tbl_servers.[End_time]= #" & Me.Combo7 & "# And "
blnTrim = True
End If
'if Reboot Method
If Not IsNull(Me.Combo11) Then
strWhere = strWhere & "tbl_servers.[reboot_method]= '" & Me.Combo11 & "' And "
blnTrim = True
End If
'If Day
If Not IsNull(Me.Combo13) Then
strWhere = strWhere & "tbl_servers.[Day]= '" & Me.Combo13 & "' And "
blnTrim = True
End If
If blnTrim Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
stDocName = "rpt_server_details"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit Sub
And yes, I know I should change the names of the combo boxes to something more meaningful, but at the moment i'm just trying to get the above to work for Reboot_method!!
Many thanks in advance!
Chris