• Objects

    Author
    Topic
    #356251

    I am quite new at this Access stuff – I received the following error message : 438 object doesn’t support this property or method at cmdExport_click. I understand the problem is with the command button, but what exactly is wrong?

    Viewing 1 reply thread
    Author
    Replies
    • #526908

      The problem is with the VBA code that runs when the button is pressed. I am really an Excel VBA programmer, and I don’t know exactly how Access works here. If the message box has a Debug button on it, that should show you the line of code that is causing the problem. If you copy the code around the line causing the error (preferably the whole Sub or Function if it isn’t too big), and paste it into a message here, someone can probably help you.

    • #526998

      What it is telling you is that you tried to do something that Jet doesn’t consider legal for the object you are using.

      For example, if you use Access 2000 and have both DAO and ADO references set but don’t specify which flavor of recordset you dim in a procedure, the code will compile, but you’ll get an error 438 when you get down to specifics like trying to do a findfirst, which is a DAO method, when Access thinks you should be using find, which is an ADO method.

      As Legare says, post the code so we can give you a more specific answer.

      • #527046

        Here is the code for the command button. The button is supposed to export data to an excel file.

        On Error GoTo ErrorHandler
        Dim whoami As String

        whoami = “cmdExport_Click”
        ‘dynamically Drop the AccessImport Query, CreateQuery
        for a new
        ‘one of the same name; then perform the export;
        ‘repeat the entire operation
        Dim lsFile As String
        Dim objExcel As Object
        Dim rs As Recordset

        DoCmd.DeleteObject acQuery, “AccessImport”

        • #527056

          Julie, we were all new to Access at one time. This forum is a great place to learn stuff.

          If all you want to do is transfer information from Access to Excel, you can do this with a macro.

          Click on the Macro tab on the database window. Click on the New button. In the Action column, click the dropdown arrow. It shows you the list of Actions. The first Action I usually run is a make table query. Select OpenQuery from the list of actions and enter the name of your query. If you don’t need to query for information, you can skip this step.

          The next Action is the TransferSpreadsheet action. In the Action Arguments section of the macro design window, there are six arguments that you have to fill in. They are self-explanatory. The Transfer Type is Export. Be sure to type in full path to the File Name in Excel, such as c:MyDocumentsAccessMyData.xls.

          Add the RunApp action as the next, and last, action you need in this macro. It has one argument, Command Line. Here is a typical command line:

          c:Program FilesMicrosoft OfficeOfficeexcel.exe c:MyDocumentsAccessMyData.xls

          Be sure an place a space between excel.exe and c:.

          Save it, name it, and run it. If you do it right, this will work well for you.

          HTH.

    Viewing 1 reply thread
    Reply To: Objects

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: