Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jul 2002
    Location
    Wellington, New Zealand
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invalid Arguement with Select into (2k 9.0.4402 SR1)

    I am trying to create tables programatically

    When I run the code I the machine processes for a while then returns
    Run Time error 3001 - Invalid Arguement

    below is a rather simplified version of the code that produces the same error


    Dim strSQL As String 'this is the SQL statement
    Dim dbs As Database

    strSQL = "SELECT tbl_Source.ContentsID, tbl_Source.IDNO,"
    strSQL = strSQL & " tbl_Source.ChemicalName , tbl_Source.Present, "
    strSQL = strSQL & " tbl_Source.Present2 INTO tbl_Result
    strSQL = strSQL & " FROM tbl_Source"
    strSQL = strSQL & " WHERE (((tbl_Source.ChemicalName)='water'));"

    Set dbs = OpenDatabase("<PATH to DATABASE>")
    dbs.Execute strSQL
    dbs.Close

    This queries a table of 175,000 records and should return around 10,000 records

    I have tried running the same code via the query editor and get the same result
    When I try a select query I get the correct recordset but if I view from within a Make
    Table query I get the error about 50% of the time

    I have tried creating the table both manually and programatically and then appending
    records both via the query editor and programatically. But I get the same error.

    I have run Compact and Repair
    I have run Detect and Repair
    Neither of which seems to make a difference

    The database I am working on was originally created in Access 2 and steadily upgraded
    with new releases.

    O/S is Win2K workstation sp2 on the desktop and Win2k Server sp2 on the Server
    The Network guy tells me that they are vanilla installs

    Any help would be appreciated as I have lost a day to this already

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

    Re: Invalid Arguement with Select into (2k 9.0.4402 SR1)

    You're code is trying to execute a select query, which isn't what you say you're trying to do and which won't work anyhow. I'm assuming that "<PATH to DATABASE>" represents a variable rather than a literal value, but what does your make table or append query SQL look like? According to the help files for DAO 3.6 ...
    <hr>The Execute method is valid only for action queries. If you use Execute with another type of query, an error occurs. Because an action query doesn't return any records, Execute doesn't return a Recordset.<hr>
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid Arguement with Select into (2k 9.0.4402 SR1)

    In addition to what Charlotte says, what do you want to create ?
    A recordset or a table?

    To create a table you have to use the SQL CREATE TABLE statement
    Then you have to append the Records with the INSERT statement
    You can find help about these statements in the help files, but you have to install the SQL help files. They are not installed by default.

    To create a record set add
    Dim rst As RecordSet
    and replace dbs.Execute strSQL by
    Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
    Francois

  4. #4
    Lounger
    Join Date
    Jul 2002
    Location
    Wellington, New Zealand
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid Arguement with Select into (2k 9.0.4402 SR1)

    Charlotte / Francois
    I have just discovered that the error is caused by one corrupt record in the table
    Knowing this I will continue on. Thanks for your input on the other matters
    and for taking time to help

    Cheers

Posting Permissions

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