Convert SQL query Sub to Function

S

Steve

I have a macro that queries an access database, and would like to turn
it into a user-defined function. The recordset that is returned should
always be one value only. I am stuck at this place in my code:

rst.Open SQLstr, conn
Range("C1").CopyFromRecordset rst

It works now, returning the value to Range("C1") on the worksheet. How
do I assign the query result to a function value? Thanks.
 
G

Guest

either of these espressions will give you the value

rst.getstring

rst.fields(0).value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top