473,408 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

calling access vba function from asp?

Dear all,

I have an asp module connecting to a MS-access database.
I have a vb function MKDate(date, time) in a vba module of this
database.

I would like to query :
SELECT MKDATE(col1, col2) FROM TABLE1

(real query is complex, using unions, etc, but I need one column in
resultset)

But I get an error opening the recordset
"Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Undefined function 'MKDATE' in
expression.
/selfmail/dossier.asp, line 729"

I also tried to copy the code of the function MKDate(date, time) inside
..asp module, no change.
Is it possible to call a vba function inside an asp sql statement?

Regards,
Alain
Jun 27 '08 #1
3 5067
Alain Bourgeois wrote:
>
Is it possible to call a vba function inside an asp sql statement?
No, it is impossible to call user-defined VBA procedures from any
external application, including asp. It's been a thorn in our sides for
years. You will need to find another way to accomplish your task.

For this specific purpose, you don't need a user-defined function.
Without knowing the datatypes of col1 and col2, I cannot be specific,
but I'm sure you can do this conversion in your query without a
user-defined function.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 27 '08 #2
I don't have ASP setup to try it, but what if you make a Query in Access
which internally calls the vba code & then call that from the ASP?

such as
MyTestQuery =
INSERT INTO TableName(col1, col1, col3) VALUES( @param1, @param2,
MyFunc(@param1,@param1) )

in ASP:

Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=" & Server.MapPath("MyDB.mdb")

' Connection Object
Dim con
Set con = Server.CreateObject("ADODB.Connection")

' connecting to database
con.Open connStr
' executing stored procedure
con.Execute "exec MyTestQuery 'valu1', 'value2', 'value3', 'value4' "

' closing connection and freeing resources
con.Close
Set con = Nothing
Would this work ?

"Bob Barrows [MVP]" wrote:
Alain Bourgeois wrote:

Is it possible to call a vba function inside an asp sql statement?

No, it is impossible to call user-defined VBA procedures from any
external application, including asp. It's been a thorn in our sides for
years. You will need to find another way to accomplish your task.

For this specific purpose, you don't need a user-defined function.
Without knowing the datatypes of col1 and col2, I cannot be specific,
but I'm sure you can do this conversion in your query without a
user-defined function.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 24 '08 #3
Wes wrote:
I don't have ASP setup to try it, but what if you make a Query in
Access which internally calls the vba code & then call that from the
ASP?
It won't work. BTDT.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 24 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mario Pranjic | last post by:
Hi! I have a scalar function that returns integer: xview (int) Now, I'm trying to build a procedure that has the following select inside: select atr1, xview(atr2) from tablename
3
by: Ken | last post by:
hello, I would to know if it is possible to call an object in a function within a class. Meaning , In a class, A function X calling onto a function Y, and function Y we want one of the two...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
14
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() '...
1
by: Sen K via .NET 247 | last post by:
(Type your message here) Hi, Any help is appreciated. I have a situation wherein i need to compact access db after somebusiness logic through VB.NET.I've written a function in VBA tocompact...
1
by: Abhishek | last post by:
Hello All I am able to call the function exported by Exe from a dll file im getting the address of the function but whille calling that function im getting access violation Error as bellow my code...
5
by: Stinky Pete | last post by:
Hi (again) ;-) I'm still very much at the bottom of a steep learning curve with VB, so any and all help is always appreciated. I've found some code to generate the user names who have logged...
15
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
3
by: keirnus | last post by:
Hello once again... I made a function in Excel. The function does some error checking within the Excel file. To be easy for me, I want my code in MS Access to simply call the function in Excel....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.