Results 1 to 4 of 4
  1. #1
    Rev12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11

    Display my PDF file name in my list box in a Form

    Hi Everyone!



    I have a listbox name txtfilename in my form and I have this code hoping to display all my PDF files in my listbox in a Form
    and I have an error as below

    Private Sub Form_Load()

    Dim sPath As String Dim sFile As String


    sPath = "C:\TESTFILE"
    sFile = Dir(sPath & "*.pdf")
    Do While sFile <> vbNullString
    If sFile <> "." And sFile <> ".." Then
    'Me.txtfilename.AddItem sFile <<<<<----------- it highlights here = Compile Error : Method or Data member not found
    End If
    sFile = Dir
    Loop


    Exit Sub

    End Sub

    Can anyone is kind to help on how to figure out the error??

    Thanks in advance.

    Rev12

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Are you sure that's a listbox? The prefix would imply a textbox, which would not have AddItem as a method.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Rev12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11
    Thanks now it works will

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Glad you got it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 05-12-2016, 06:08 AM
  2. How to display attachment file name in a form?
    By HelpMeWithAccess in forum Access
    Replies: 6
    Last Post: 06-26-2014, 12:52 AM
  3. PDF File content display on Access 2013 form
    By saleemsadique in forum Access
    Replies: 7
    Last Post: 02-07-2014, 06:36 PM
  4. Replies: 4
    Last Post: 02-07-2013, 03:58 PM
  5. Replies: 13
    Last Post: 06-01-2010, 09:55 PM

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