473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

[DB ACCESS] Module and batch file

263 100+
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
3 5580
ADezii
8,834 Expert 8TB
  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
viki1967
263 100+
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
8,834 Expert 8TB
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

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

Similar topics

1
by: Rob | last post by:
I'm running a batch file using the Shell function. When I manually launch the batch file, the window remains open, since I use the 'pause' statement. But when I launch the batch file within...
9
by: Karl Irvin | last post by:
Does anyone have an example of an FTP script or module for use with Access 2003. I need to send a file from by computer to my web host from within Access. The from folder may or may not be the...
4
by: ScoobyDoo | last post by:
Anyone know how I can create and edit batch files from MS Access 2002?
6
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and...
4
by: CliffKing | last post by:
I am trying to use Windows Task Scheduler to run a batch file for an already open MS Access database. Below is the syntax to the batch file: Batch file: DailySalesExport.bat REM This runs the...
26
by: mvdkwong | last post by:
What's the trick to running a batch file from VBA? I'm trying to call it using the Shell function but it's not working for me. If I double-click the batch file or run it from the command line it...
8
by: Yitzak | last post by:
Hi is there a way to run a SQL Script to Update an Access Schema. Without using VBA code. E.g. in mssql server I can run script like if not exists (select * from syscolumns where name =...
9
by: Matt | last post by:
How would I do this ... I want to set the Windows Scheduler to run the ..bat file which will open an access database at like 2 in the AM. What code do I need in the .bat file.
6
by: MrDeej | last post by:
Hello! I have code wich scans the through 10 computers on a LAN for files and import them into different tabels. This code aproximitly imports 10 000 files (with 1 to 20 rows of info) a day and is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.