By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,118 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,118 IT Pros & Developers. It's quick & easy.

[DB ACCESS] Module and batch file

100+
P: 263
Hi all.

I have this module in the DB ACCESS.

Expand|Select|Wrap|Line Numbers
  1. Function estrai()
  2. Dim dbs As Database
  3. Set dbs = CurrentDb
  4.  
  5.     g_HostSettleTime = 15
  6.         Dim Sessions As Object
  7.     Dim System As Object
  8.     Set System = CreateObject("EX.System")   
  9.     If (System Is Nothing) Then
  10.         MsgBox "Errore."
  11.         Stop
  12.     End If
  13.     Set Sessions = System.Sessions
  14.  
  15.     If (Sessions Is Nothing) Then
  16.         MsgBox "Errore."
  17.         Stop
  18.     End If
  19.  
  20.         Dim sess0 As Object
  21.         Set sess0 = System.ActiveSession
  22.         If (sess0 Is Nothing) Then GoTo init
  23.         System.Quit
  24.  
  25. init:
  26.         Shell ("c:\programmi\ex\session.exe")
  27.  
  28. ...
  29.  
  30.     Application.Quit
  31. End Function
and I write this batch file:

Expand|Select|Wrap|Line Numbers
  1. @echo off
  2.  
  3. "C:\Programmi\Microsoft Office\OFFICE11\msaccess.exe" 
  4. "D:\Inetpub\wwwroot\mdb-database\database.mdb"
  5. /cmd Estrai()
The idea is open the DB Access and start the function Estrai() with the batch file.

No error but the function Estrai() not start, why?

Can you help me?
kind regards
viki
Sep 24 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,628
  1. Create a Macro, let's say mcrExecuteFunction for simplicity.
    • Set the Action Column of the Macro = RunCode
    • Set the Function Name = Estrai()
    • Make sure the Function is Declared as Public in a Standard Code module
  2. Create the Batch File as follows:
    Expand|Select|Wrap|Line Numbers
    1. @echo off 
    2. cls
    3. "C:\Programmi\Microsoft Office\OFFICE11\msaccess.exe"  _
    4. "D:\Inetpub\wwwroot\mdb-database\database.mdb"  _
    5. /x mcrExecuteFunction 
  3. Now, when you Run the Batch File, Access will Open Database.mdb, and Execute the Macro mcrExecuteFunction (/x mcrExecuteFunction), which in turn will Execute the Estrai() Function
Sep 24 '08 #2

100+
P: 263
Many thanks x your answer.

Your method working but I have one alert window in the connection.

If I continue the macro working.

I'ts possible in the file batch erase or ignore all alert ?

kind regards
Sep 24 '08 #3

ADezii
Expert 5K+
P: 8,628
Many thanks x your answer.

Your method working but I have one alert window in the connection.

If I continue the macro working.

I'ts possible in the file batch erase or ignore all alert ?

kind regards
Sorry, but you will have to be much more specific.
Sep 24 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.