Results 1 to 5 of 5

Thread: Objects

  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Objects

    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?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Objects

    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.
    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Objects

    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.
    Charlotte

  4. #4
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Objects

    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"
    '

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Indiana, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Objects

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •