Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to call a VBA function (in Access) from VB (or ASP) ?
Message
De
12/09/2001 16:40:57
Simon La Rochelle
Consultant En E-Commerce
Granby, Québec, Canada
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Access
Titre:
How to call a VBA function (in Access) from VB (or ASP) ?
Divers
Thread ID:
00555699
Message ID:
00555699
Vues:
68
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform