Results 1 to 7 of 7
  1. #1
    compooper is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    87

    Unhappy Error: Object Required

    Hi guys!
    I am using a code from one of Roger's Access Sample Databases & I am getting the error: Object Required



    Code:
     
    Private Sub cmdBrowse_Click()
        On Error GoTo Err_cmdBrowse_Click
        Dim strFilter As String
        Dim lngFlags As Long
        strFilter = ahtAddFilterItem(strFilter, "Comma Delimited (*.csv)", "*.CSV")
        'MsgBox "You selected: " &
        Me.txtPath = ahtCommonFileOpenSave(InitialDir:="C:\", _
            Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
            DialogTitle:="Hello! Open Me!")
        
        txtToDirectory.Visible = True
    Exit_cmdBrowse_Click:
        Exit Sub
    Err_cmdBrowse_Click:
        MsgBox Err.Description
        Resume Exit_cmdBrowse_Click
    
       
    End Sub
    where ahtCommonFileOpenSave is the popular code by Ken Getz
    How can I get ride of this error?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    What line gives the error?
    Do you have ahtAddFilterItem and ahtCommonFileOpenSave defined?

    Have you tried setting breakpoints to see what the error is?

  3. #3
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Hi,
    This code is only applying filter to some text path:

    Me.txtPath = ahtCommonFileOpenSave(InitialDir:="C:\", _
    Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
    DialogTitle:="Hello! Open Me!")

    and showing
    txtToDirectory.Visible = True.

    There is no code for browsing any directory???? there should be more coding for browsing.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Make sure that you've pasted the ENTIRE set of procedures from this:
    http://access.mvps.org/access/api/api0001.htm
    Into your STANDARD MODULE (not form, report, or class module) and named it something different than any of the procedures. Then, also you might try using the function GetOpenFile instead if you don't need all of the different options.

  5. #5
    compooper is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    87
    Thanks for all of the responses.

    I have the following things defined:

    Module: Importing
    http://access.mvps.org/access/api/api0001.htm
    & I changed it by adding the following to ahtCommonFileOpenSave
    Dim strFilter As String
    strFilter = ahtAddFilterItem(strFilter, "Comma Delimited (*.csv)", "*.CSV")
    ...
    If IsMissing(Filter) Then Filter = strFilter
    If IsMissing(FilterIndex) Then FilterIndex = 1

    & the code above (previous post) on my OnClick Event for the browse button

    Even if I take out my "editations" on the Importing Module, the error still appears.
    Last edited by compooper; 06-21-2011 at 12:21 PM. Reason: Adding a little more info

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Do NOT modify ahtCommonFileOpenSave AT ALL. Get rid of the code you have in that module and copy it again from the web page. That code is already complete. You do not need to add that filter code to that procedure.

    There is already another procedure in that whole set of code which adds the filters. You would CALL the ahtAddFilterItem procedure. Don't try re-inventing the wheel here. That entire set of code is fully operational. You just need to call it correctly.

  7. #7
    compooper is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    87
    Okay thanks. I figured it out

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Object Required Error.
    By Robeen in forum Forms
    Replies: 1
    Last Post: 03-28-2011, 10:30 AM
  2. Run-time error '424': Object required
    By cowboy in forum Programming
    Replies: 18
    Last Post: 07-07-2010, 03:32 PM
  3. Replies: 3
    Last Post: 04-15-2010, 09:43 AM
  4. Replies: 3
    Last Post: 03-30-2010, 01:21 PM
  5. Object required
    By duckie10 in forum Access
    Replies: 1
    Last Post: 05-15-2009, 02:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums