Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Runtime Error '2448':

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ryan - 28 Mar 2007 03:06 GMT
I keep getting 'Runtime Error 2448' when I run the code below.  When I debug
it highlights me.Filter=strWhere.  Any suggestions??

Private Sub Filter_Click()
Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.TypeFilter) Then
  strWhere = strWhere & "([Type]=""" & Me.TypeFilter & """)And"
End If
If Not IsNull(Me.StatusFilter) Then
  strWhere = strWhere & "([Status]=""" & Me.StatusFilter & """)And"
End If
   lngLen = Len(strWhere) - 5
   If lngLen <= 0 Then
       MsgBox "No criteria", vbInformation, "Nothing to do."
   Else
       strWhere = Left$(strWhere, lngLen)

       Me.Filter = strWhere
       Me.FilterOn = True
       End If
End Sub

Private Sub Form_Open(Cancel As Integer)
'Me.Filter = "(False)"
'Me.FilterOn = True

End Sub

Private Sub RemoveFilter_Click()
   Dim ctl As Control
   
   For Each ctl In Me.Section(acHeader).Controls
       Select Case ctl.ControlType
       Case acTextBox, acComboBox
           ctl.Value = Null
       Case acCheckBox
           ctl.Value = False
       End Select
   Next
   Me.FilterOn = False
End Sub

Private Sub Ticket__Click()
DoCmd.OpenForm "ISTroubleTicket", , ,
"[ISTroubleTicket]![Ticket#]=Forms![TroubleTicket query]![Ticket#]"
End Sub
AccessVandal - 28 Mar 2007 05:13 GMT
Hi Ryan,

Try,

>Ryan wrote:
>I keep getting 'Runtime Error 2448' when I run the code below.  When I debug
>it highlights me.Filter=strWhere.  Any suggestions??

Private Sub Filter_Click()
Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.TypeFilter) Then
  strWhere = strWhere & "([Type]="" & Me.TypeFilter & """) & " And "
'Edited here
End If
If Not IsNull(Me.StatusFilter) Then
  strWhere = strWhere & "([Status]="" & Me.StatusFilter & """) & " And "
'Edited here
End If
   lngLen = Len(strWhere) - 5
   If lngLen <= 0 Then
       MsgBox "No criteria", vbInformation, "Nothing to do."
   Else
       strWhere = Left$(strWhere, lngLen)

       Me.Filter = strWhere
       Me.FilterOn = True
       End If
End Sub
AccessVandal - 28 Mar 2007 05:17 GMT
Not sure about the curve brackets.

If it didn't work, try remove the curve brackets.

>Ryan wrote:
SteveS - 28 Mar 2007 05:18 GMT
Ryan,

For debugging purposes, add a message box here:

'---<snip>-----
   Else
       strWhere = Left(strWhere, lngLen)

     ' for debugging
      Msgbox strSwhere

       Me.Filter = strWhere
'---<snip>-----

It looks like you are missing a space before and after the "AND" in the two
IF() statements.

 strWhere = strWhere & "([Type]=""" & Me.TypeFilter & """)And"
                                                                           
        ^^^^

  strWhere = strWhere & "([Status]=""" & Me.StatusFilter & """)And"
                                                                           
             ^^^^

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> I keep getting 'Runtime Error 2448' when I run the code below.  When I debug
> it highlights me.Filter=strWhere.  Any suggestions??
[quoted text clipped - 44 lines]
> "[ISTroubleTicket]![Ticket#]=Forms![TroubleTicket query]![Ticket#]"
> End Sub
Ryan - 28 Mar 2007 14:36 GMT
You were correct Steve, I was missing a space in front of the AND.  Thank you
for your help!

> Ryan,
>
[quoted text clipped - 71 lines]
> > "[ISTroubleTicket]![Ticket#]=Forms![TroubleTicket query]![Ticket#]"
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.