Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Question Unanswered: Saving Recordset To Another .mdb File

    I have this question

    1. How To Save a recordset directly to another file than the file i use to open it ?

    2. How to sort a Date in Datagrid. i get this error :
    run-time error '3001'
    arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    I use Date Format on the database.
    And i use DTpicker to fill the value.

    Thanx for the answer...

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Saving Recordset To Another .mdb File

    Once you have your initial recordset, create a new connection to the second database, from there call your SQL statements using the new connection i.e.

    Dim Connection1 as ADODB.Connection
    Dim Connection2 as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set Connection1 = new ADODB.Connection
    Set Connection2 = new ADODB.Connection

    Connection1 .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    Connection1.Open

    rs.Open "SELECT * FROM Table1", Connection1

    Connection2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    Connection2.Open

    Connection2.Execute "INSERT Table2(Field1) SELECT '" & rs.Fields("Field1") & "'"

    rs.Close

    Connection1.Close
    Connection2.Close

    Set rs=Nothing
    Set Connection1= Nothing
    Set Connection2= Nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Mar 2004
    Posts
    4

    Question Sorting Date ?

    Hei Scirocco. Thanx For The Answer.

    But, can you solve my prob when sorting date in datagrid ?
    i got that error message., I can sort any other fields beside date.
    The Format impossibly false, since i use DateTimePicker to input the data.

    Any Clue Will Help....
    By The Way... MSDN Doesn't Help much.

    Thanx ...

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Sorting Date ?

    One suggestion is to convert the DateField into an integer (I beleive there is a unique number for every date since 1900) when doing the sort and then you should be able to sort fine.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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