Lonely Wolf
December 2nd, 1999, 02:51 AM
I have to copy a record from a recordset to the clipboard.
Anyone can help me?
Thanks.
Anyone can help me?
Thanks.
|
Click to See Complete Forum and Search --> : records to clipboard Lonely Wolf December 2nd, 1999, 02:51 AM I have to copy a record from a recordset to the clipboard. Anyone can help me? Thanks. mikledet December 2nd, 1999, 04:54 PM 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 Lonely Wolf February 22nd, 2000, 05:46 PM 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. TH1 February 23rd, 2000, 08:03 AM 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 Lonely Wolf February 24th, 2000, 03:10 AM I always use DAO, so i'll try it. Thanx Ravi Kiran February 24th, 2000, 04:15 AM 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 Lothar Haensler February 24th, 2000, 04:23 AM 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) codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |