Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Call parameter query in Access from Excel VBA?

I've prepared a query in Access that calculates a number that I want to display in Excel, using VBA and ADO. Here's the query in Access:

PARAMETERS [p_month] DateTime;
SELECT Count(*) AS [Number]
FROM (SELECT DISTINCT Occupancy.PersonID
FROM Occupancy WHERE (((Occupancy.Month)=[p_month]))
) AS [Table];

So, the query accepts a parameter and returns a value. Because it's just a value, I figure I won't need to construct a recordset object. All examples I've seen so far returns a recordset, but I hope to make this simple and fast. How would you call this query from VBA and how do you extract the return value?

Gustaf
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Call parameter query in Access from Excel VBA?

Not that familiar with Acess, but most likely you could do this be adding an
"out" parameter to your procedure.

http://groups.google.com/group/micro...4f98c5257ffa54

Tim


"Gustaf" wrote in message
...
I've prepared a query in Access that calculates a number that I want to
display in Excel, using VBA and ADO. Here's the query in Access:

PARAMETERS [p_month] DateTime;
SELECT Count(*) AS [Number]
FROM (SELECT DISTINCT Occupancy.PersonID
FROM Occupancy WHERE (((Occupancy.Month)=[p_month]))
) AS [Table];

So, the query accepts a parameter and returns a value. Because it's just a
value, I figure I won't need to construct a recordset object. All examples
I've seen so far returns a recordset, but I hope to make this simple and
fast. How would you call this query from VBA and how do you extract the
return value?

Gustaf



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass parameter to access query Bill Manville Links and Linking in Excel 4 May 1st 23 03:45 AM
Linking parameter query from Access to pivot table in Excel ken1975 Excel Discussion (Misc queries) 2 June 20th 06 01:51 PM
Cell value as parameter for VBA access query Gegle Excel Programming 4 November 29th 05 04:58 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM
Pass Parameter to Access Query Al Excel Programming 3 April 29th 04 10:15 AM


All times are GMT +1. The time now is 05:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"