CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 1999
    Location
    Italy
    Posts
    80

    records to clipboard

    I have to copy a record from a recordset to the clipboard.
    Anyone can help me?
    Thanks.

    Something over there is coding....
    ... and you don't know!

  2. #2
    Join Date
    Sep 1999
    Posts
    102

    Re: records to clipboard

    try this - this bit will retrive a query to a clip board - hope it help.
    (accsess data base)

    Private Sub Form_Load()
    Dim Db As Database
    Dim Rec As Recordset

    Set Db = DBEngine.Workspaces(0).OpenDatabase("c:\mydatabase.mdb")
    Set Rec = Db.OpenRecordset("SELECT statment", dbOpenDynaset)
    Clipboard.SetText (Rec.Fields("QueryResult").Value)
    End Sub


  3. #3
    Join Date
    Nov 1999
    Location
    Italy
    Posts
    80

    Re: records to clipboard

    what is "QueryResult"?
    VB wants an index and using an index it copy only a single field not the entire record.

    I don't understand, so please be more specific thanks.

    Something over there is coding....
    ... and you don't know!

  4. #4
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: records to clipboard

    Using ADO

    dim cnn as ADODB.connection
    dim ars as ADODB.recordset
    set cnn = new ADODB.Connection
    With cnn
    .ConnectionString = whatever
    .Open
    End With
    set ars = cnn.Execute("select code from mytable")
    Clipboard.Clear
    Clipboard.SetText (ars!code)



    This will put the first code returned by the recordset onto the clipboard
    The same method can easily be ported to RDO or DAO
    Hope his helps
    Tony


  5. #5
    Join Date
    Nov 1999
    Location
    Italy
    Posts
    80

    Re: records to clipboard

    I always use DAO, so i'll try it.
    Thanx

    Something over there is coding....
    ... and you don't know!

  6. #6
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: records to clipboard

    You could write out the whole recordset in a predefined format and write the whole thing as data to clipboard and then read back as data, and unparse it.

    What else, XML is the BEST for this.

    RK

  7. #7
    Join Date
    May 1999
    Posts
    3,332

    Re: records to clipboard

    IMHO the best way to do this is the GetString method in ADO (equivalent to RDO's GetClipString).
    from the docs:
    "Returns the Recordset as a string-valued Variant (BSTR)."

    clipboard.settext rst.GetString(adClipString)


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured