View Full Version : call sub in access module from VB


rajat
02-14-2006, 05:45 AM
hi,
how can i call a sub/function in access from VB.

there is a sub called import in a module modX
i need to call this sub from vb

i tried Call DoCmd.OpenModule(strModName, strSubName) but nothing happens.

Even this didnt work....
Set acObject = CreateObject("Access.application")
acObject.DoCmd.OpenModule(strModName, strSubName)


also if write a function in that module which takes a parameter.....how can i call that function(in access) from VB and pass that parameter.

TIA

KenHigg
02-14-2006, 05:50 AM
See if the 'simple function' example I posted here will help:

http://www.access-programmers.co.uk/forums/showthread.php?t=99777

rajat
02-14-2006, 06:04 AM
thanks for quick reply ken....but iam using Visual Basic 6.0

so i need to call this sub/function from vb......thats where i got an issue......code in vb runs (post above) but nothing happens

i actually tryin to export tables/queries/reports/modules from one access database to another programmatically......the function i have written in access module to do the export works.....i need to call that function from VB
thats where the prob is!!!

ghudson
02-21-2006, 04:16 PM
Have you tried setting a reference to your db from within your vb program? That should allow your vb program to run a function from your db. It works with db's so in theory it should work with your vb program.

supercharge
03-24-2006, 01:18 PM
Why not adding the module to your vb itself, just wonder?