Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to call a VBA function (in Access) from VB (or ASP) ?
Message
From
12/09/2001 16:40:57
Simon La Rochelle
Consultant En E-Commerce
Granby, Quebec, Canada
 
 
To
All
General information
Forum:
Visual Basic
Category:
Access
Title:
How to call a VBA function (in Access) from VB (or ASP) ?
Miscellaneous
Thread ID:
00555699
Message ID:
00555699
Views:
69
Hi,

I need to call a function from a module in my Access database to Randomize()
before using RND() in my query.

But I get this err :

Microsoft JET Database Engine (0x80040E14)
Undefined function 'randomizer' in expression.
/stindustriel/include-TopRating.asp, line 196


My strSQL is :

SELECT TOP 20 [Families.FamilyID]
FROM [Families]
WHERE randomizer()=0
ORDER BY RND(ISNULL(Families.FamilyName)*0+1);

And finally, my function (from a module in Access) is :

Function Randomizer() As Integer

Static AlreadyDone As Integer

If AlreadyDone = False Then Randomize: AlreadyDone = True

Randomizer = 0

End Function

When I execute my query in Access, all is fine. But when I try to execute it
from ADO, i didn't work. If I build my query in Access and just try to get it with, for exemple SELECT * FROM [quFamilies], I also get the error.

My question is :

Is there a way to call a VBA function from ADO before executing a query ? Or is there a way to Randomize() before using the RND function ?

Thanks for any help.

Simon
Next
Reply
Map
View

Click here to load this message in the networking platform