Microsoft Office Spreadsheet 11.0 -- DataSource
- From: "--Hojo--" <josephthornton@xxxxxxxxx>
- Date: 10 Nov 2006 11:43:52 -0800
I've got an Access ADP connecting to SQL Server 2000. I got tired of
having to build and save a view or a stored procedure every time I
wanted to run a simple Ad Hoc query, so I built a form with a multiline
text box, a button to "Run SQL Query", and a datagrid control to
display the results of my query.
It works great, except I want to be able to select the results, copy
them, and paste them into Excel or an email. Rather than try to build
that functionality into the Microsoft Datagrid 6 control I'm using,
I've tried to replace it with a Microsoft Office Spread*** 11.0
control.
One time out of a thousand, I got the Spread*** control to accept and
display my query results like this:
Dim rst As ADODB.Recordset
On Error Goto ErrHandler
Set rst = CurrentProject.Connection.Execute(Me.MyTextBox)
If Not rst.EOF Then
Set Me.MyDataGridControl.DataSource = rst
Set Me.SQLResultSpread***.DataSource = rst
'... Resources released later ...
After it worked that one time, I have not been able to duplicate this
very awesome functionality. The one time that it did work, I had first
established a Data Source connection to one of my database tables
through the built-in control "Commands And Options" properties. As you
can see, I also had the existing Datagrid on the form at the same time.
Now I can't go back and get the same result for love or money.
Any help would be appreciated,
--Hojo--
.
- Prev by Date: Re: Update existing detail records upon change in master field
- Next by Date: Executing MS Excel through MS Access vba
- Previous by thread: Re: question about updating fields in subform from mainform
- Next by thread: Executing MS Excel through MS Access vba
- Index(es):