Results 1 to 13 of 13
  1. #1
    TimC is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34

    Run Time Error 438 - Please Help

    I have created a database that includes a form and subform. Unfortunately, I get a visual basic error when the form opens that reads “Run Time Error 438 – Object doesn’t support this property or method. When I click debug, it takes me to the code. The code appears fine (and has worked with other databases in the past). I am thinking the code is referencing the attachment box on the form. Not sure how to change it from a bound field to an unbound field. This is likely a quick fix for the right person. Other minor issues….. I want to change the highlight color on the current field within the form. The time feature is not working on the form (current coding worked with other databases). And the search function at the bottom of the form is not sorting in alpha order (current colding also worked with other databases). All issues could be related (except highlight), but I do not know for certain. Please help. Thanks.



    Tim

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    You have successfully used this exact code in other databases?

    Do I understand, want to build a string of the attachment names and display in a textbox? Is textbox bound to a field - why save the names?

    I tried your code and works fine for me.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    usually this means you are missing references.. Go to the modules vba and pick tools and then look at the references and see if any of them say (missing)
    that would be your problem.

    hope this helps

  4. #4
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    ok I check the database for references and they were ok.. I have no knowledge of how to deal with attachments. Something I will lookup though.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    The code worked for me. References selected:

    Visual Basic For Applications
    Microsoft Access 12.0 Object Library
    OLE Automation
    Microsoft Office 12.0 Access database engine Object Library
    Microsoft ActiveX Data Objects 2.8 Library
    Microsoft Excel 12.0 Object Library
    Microsoft Office 12.0 Object Library
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    Dim i As Integer, strFileList As String


    txtDOB_AfterUpdate


    If Me.NewRecord Then
    Me.txtLast.SetFocus
    Me.lstFileList.RowSource = ""

    Me.cmdSaveNew.Enabled = False
    Me.cmdSaveClose.Caption = "Close"
    Me.cmdPrint.Enabled = False
    Else
    Me.lstFileList.RowSource = ""
    Me.cmdSaveNew.Enabled = True
    Me.cmdSaveClose.Caption = "Save && Close"
    Me.cmdPrint.Enabled = True

    For i = 0 To Me.attAttachments.AttachmentCount - 1
    Me.lstFileList.AddItem (Me.attAttachments.FileName(i))
    Next i
    End If

    I changed the txtFileList to a listbox lstFileList changed the row source list to value list.. and it worked like a champ..
    I think you will like the list box better than the txt box..

  7. #7
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    Yes the problem was you had the text box source set to attachment it needed to be unbound.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Code worked for me even if textbox was bound to a text field, not the attachment field of course.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    For me It was set to a attachment field type and it wouldn't work.

  10. #10
    TimC is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34
    You are correct; this coding worked successfully in this and other databases before adding the subform. Not sure what has happened since then. I do want to display the file attachment names in the text box. Your assistance is appreicated. Thanks.

  11. #11
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    go to the sub form and txtFilelist should be set to unbound.

  12. #12
    TimC is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    34
    Solved; thx

  13. #13
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    the only reason I suggested the listbox is that you could use the rows as input for anything you wanted other than just a string.

    just a suggestion..

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

Similar Threads

  1. Error: Run-time error '13' Type mismatch
    By uronmapu in forum Access
    Replies: 1
    Last Post: 09-07-2012, 05:38 AM
  2. Replies: 4
    Last Post: 07-25-2012, 04:01 AM
  3. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Replies: 5
    Last Post: 03-27-2012, 01:40 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