Re: Getting SQL recordset into Access table
From: Mary Chipman (mchip_at_nomail.please)
Date: 02/10/04
- Next message: Faddrick: "Transferring datas to excel"
- Previous message: Jim: "Import problems"
- In reply to: DaveCop: "Getting SQL recordset into Access table"
- Next in thread: DaveCop: "Re: Getting SQL recordset into Access table"
- Reply: DaveCop: "Re: Getting SQL recordset into Access table"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 09:19:27 -0500
What you can do is create a pass-through query that will return the
result set from the stored procedure. You can do this in VBA/DAO by
supplying the parameter values in code:
cnn.Execute "myProc " & varParam1 & ", " etc.
This will return a read-only result set and you can base another,
regular query on that has a WHERE clause. Or you can dump the results
of the second query into a local Access/Jet table, where it's easy to
manipulate the data from a bound form. If you need to get this data
back into SQL Server, then you'll need to write VBA/ADO code to
execute INSERT or UPDATE statements.
-- Mary
Microsoft Access Developer's Guide to SQL Server
http://www.amazon.com/exec/obidos/ASIN/0672319446
On Mon, 9 Feb 2004 19:55:27 -0800, "DaveCop"
<anonymous@discussions.microsoft.com> wrote:
>I have an Access application which needs to include/work
>with some data that resides on a SQLServer database.
>Currently I have access to a stored procedure on the SQL
>system which returns a recordset (ADO, but could use DAO).
>Since the sp on SQL needs to be called via pass thru (or
>at least I don't know of another way to execute it) and
>since it also requires parameters (e.g. a date but not
>normally todays date), I 'have to' (again AFAIK) build the
>proper pass thru sql statement in VBA and execute it from
>there.
>
>That all works fine (i.e. I get my data back in the
>recordset) but now I need to 'work on' this data.
>Basically I need to selectively move some or all of this
>data into an Access table. How do I 'move' the SQL
>recordset over into an Access table? I probably could open
>another rs in Access pointing to the proper Access table
>and do a field by field, row by row operation to populate
>the Access table, but I suspect this will be relatively
>slow. I hate doing things that way.
>
>Is there a better way to move the recordset into the
>table? Is there a way I can directly query the SQL
>recordset? Is there some way to have the SQL directly
>populate a table (even if that has to be on the SQL side
>[good!!!], I can probably get 'those guys' to modify the
>stored procedure)?
>
>[Personally since I typically only need a small sub-set of
>the data returned, I would prefer to just link to the sql
>table(s) and query them for the precise data I need but
>for other reasons (a long story) that is not possible.]
>
>Thanks for any help,
>Dave
- Next message: Faddrick: "Transferring datas to excel"
- Previous message: Jim: "Import problems"
- In reply to: DaveCop: "Getting SQL recordset into Access table"
- Next in thread: DaveCop: "Re: Getting SQL recordset into Access table"
- Reply: DaveCop: "Re: Getting SQL recordset into Access table"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|