Share via

Run-Time error '438' Object doesn't support this property or method

Anonymous
2014-10-15T20:17:09+00:00

So I'm trying to modify some 2010 Access code for selecting an image from a file and I get this error. I have several forms which use it and some work fine but others keep giving me this error. Here is the code:

Sub getPictureTHREE()

    ' Displays the Office File Open dialog to choose a file name

    ' for the current structure record.  If the user selects a file

    ' display it in the picture THREE image control.

    Dim fileName As String

    Dim result As Integer

    With Application.FileDialog(msoFileDialogFilePicker)

        .Title = "Select Picture THREE"

        .Filters.Add "All Files", "*.*"

        .AllowMultiSelect = False

        result = .Show

        If (result <> 0) Then

            fileName = Trim(.SelectedItems.Item(1))

            Me![THIRDPATH].Visible = True                              This is the line that is giving me the error

            Me![THIRDPATH].SetFocus

            Me![THIRDPATH].Text = fileName                                Other forms Im using this code have shown this error

            Me![PICTURE_THREE_NOTES].SetFocus

            Me![THIRDPATH].Visible = False

        End If

    End With

End Sub

Im a beginner at Access so not 100% sure what I'm doing. Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Anonymous
    2014-10-16T14:23:23+00:00

    Never mind I figured it out! Thanks!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-10-16T13:01:01+00:00

    Ok so after checking the name of the textbox it was not the same name as the code. However, once I fixed this I then got a Error 2135 Property is read only and can't be set. This is in reference to the second line I mentioned in my first post the line Me![ONEPATH].Text=fileNameso now I am confused on why I am getting this error.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-10-16T12:20:11+00:00

    THIRDPATH is the name of a field in a table and it is going to store the image path in the table after it is selected. I have another form using similar code and had a problem with the Me![PATH].VISIBLE=TRUE line and before I just rename the field in the table from PROFILE1PATH to LEFTPICTUREPATH and this solved the problem. Not 100% sure why but again I am a beginner at Access so who am I to question it when it works :)

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-10-15T20:50:28+00:00

    What kind of control is THIRDPATH? Are you sure that is its name. A better way to write it would be:Me.THIRDPATH.Visible

    By using a dot instead of an exclamation point, you will get the help of the IntelliSense. As soon as you type the dot a list of properties, methods, controls will pop up in a context menu. That will give you a way to select THIRDPATH without having to type it in blindly thus avoiding misspelling.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2014-10-15T20:45:42+00:00

    Is "THIRDPATH" the name of a control on the form?  Please double-check to make sure its name wasn't misspelled.  If it is a control, what type of control is it?

    Was this answer helpful?

    0 comments No comments