This code is embedded in the event procedure of a button. When I select a Program and year and click the button the error message I receive is as follows: "Run Time error '438' Object doesnt support this property or method." Can someone please tell me what I'm doing wrong?
The code I'm using is below...
Thanks in advance!!!!
Private Sub Command29_Click()
Dim StrWhere As String
Dim varItem As Variant
If Me.tog_BusSize = True Then
StrWhere = "("
If ((Me.lst_Prog.ItemsSelected.Count) > 0 And _
(Me.lst_FY.ItemsSelected.Count) > 0 And _
(Me.lst_Qtr.ItemsSelected.Count) = 0 And _
(Me.lst_Proj.ItemsSelected.Count) = 0 And _
(Me.lst_Output.ItemsSelected.Count) = 0) Then
For Each varItem In Me![lst_Prog].ItemsSelected
StrWhere = StrWhere & "Prod_Title =" _
& Chr(39) & Me![lst_Prog].Column(0, varItem) & Chr(39) & " Or "
Next varItem
StrWhere = Left(StrWhere, Len(StrWhere) - 4) & ")And("
For Each varItem In Me![lst_FY].Itemselected
StrWhere = StrWhere & "FY =" _
& Chr(39) & Me![lst_FY].Column(0, varItem) & Chr(39) & "Or"
Next varItem
End If
StrWhere = Left(StrWhere, Len(StrWhere) - 4) & ")"
DoCmd.OpenReport "rptBus_Size", acViewPreview, , StrWhere
End If
End Sub
The code I'm using is below...
Thanks in advance!!!!
Private Sub Command29_Click()
Dim StrWhere As String
Dim varItem As Variant
If Me.tog_BusSize = True Then
StrWhere = "("
If ((Me.lst_Prog.ItemsSelected.Count) > 0 And _
(Me.lst_FY.ItemsSelected.Count) > 0 And _
(Me.lst_Qtr.ItemsSelected.Count) = 0 And _
(Me.lst_Proj.ItemsSelected.Count) = 0 And _
(Me.lst_Output.ItemsSelected.Count) = 0) Then
For Each varItem In Me![lst_Prog].ItemsSelected
StrWhere = StrWhere & "Prod_Title =" _
& Chr(39) & Me![lst_Prog].Column(0, varItem) & Chr(39) & " Or "
Next varItem
StrWhere = Left(StrWhere, Len(StrWhere) - 4) & ")And("
For Each varItem In Me![lst_FY].Itemselected
StrWhere = StrWhere & "FY =" _
& Chr(39) & Me![lst_FY].Column(0, varItem) & Chr(39) & "Or"
Next varItem
End If
StrWhere = Left(StrWhere, Len(StrWhere) - 4) & ")"
DoCmd.OpenReport "rptBus_Size", acViewPreview, , StrWhere
End If
End Sub