General information
Title:
How to call a VBA function (in Access) from VB (or ASP) ?
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only