Connect Excel FUNCTION (VBA) to the Access Database...

a4623873

New Member
Joined
Oct 7, 2014
Messages
2
Dear friends,
I have an Excel workbook and an Access DataBase which contains data:
DATE | DATA1 | DATA2 | DATA3

I need to write a function like this:
MYFUNCTION( CR1, CR2)

Is it possible MYFUNCTION to get data from the Database? :)
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
What is CR1 and CR2? What results does it produce?

If it's part of a query you can use the function in your Access SQL query, and then execute the query from Excel. But for now I'm still not totally sure what you are trying to do, or what role DATE|DATA1|DATA2|DATA3 has.
 
Upvote 0
What is CR1 and CR2? What results does it produce?

If it's part of a query you can use the function in your Access SQL query, and then execute the query from Excel. But for now I'm still not totally sure what you are trying to do, or what role DATE|DATA1|DATA2|DATA3 has.

Thanks for your answer,
CR1 and CR2 are criterias that the function gets from the excel cells.
The Database should only contain datas, and the function should get the datas from DB using the CR2 criteria, and do some calculation then return the result in it's cell.
I have written the code for the function, but can't make it read/get data from the database.
:)
 
Upvote 0
It sounds to me like you should be setting up a parameter query rather than the function. Set-up the PQ in Access and then execute it from Excel, feeding in the parameters from the values housed in your Excel workbook.

See tutorial here.
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top