473,382 Members | 1,204 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,382 software developers and data experts.

Simple command line prompt to call MS Access Module?

Hi All:

I was wondering if there's a simple way to call a MS Access Module
through either
Command Prompt
MS Script
any other way...

Thanks for the response.

I am trying to extract some data out of a table in Access on a
scheduled basis, I figured the simplest way is to do a simple module,
have some command to extract the information, then schedule it.

thx again
tony

Mar 23 '06 #1
2 37430
Yes, sort of.

You can call a macro in the command line when you open Access. The macro
could have the RunCode command which will run a VBA function.

Example:
"<path>\msaccess.exe" "<path>\MyDatabase.mdb" /x MacroName

You can also use an AutoExec macro to automatically run code when you open
the database or place code in the Open event of your startup form to run the
procedures you need.

Another option is to use the /cmd switch on the command line. You can then
use the Command() function in code to extract this information to react as
desired.

--
Wayne Morgan
MS Access MVP
<to********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi All:

I was wondering if there's a simple way to call a MS Access Module
through either
Command Prompt
MS Script
any other way...

Thanks for the response.

I am trying to extract some data out of a table in Access on a
scheduled basis, I figured the simplest way is to do a simple module,
have some command to extract the information, then schedule it.

thx again
tony

Mar 23 '06 #2
<to********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi All:

I was wondering if there's a simple way to call a MS Access Module
through either
Command Prompt
MS Script
any other way...

Thanks for the response.

I am trying to extract some data out of a table in Access on a
scheduled basis, I figured the simplest way is to do a simple module,
have some command to extract the information, then schedule it.

thx again
tony

If the machine which is going to run the scheduled task has Access on it,
then you could call something like this:

"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"
"C:\MyExtractor.mdb" /cmd "DoExtract"

The database MyExtractor.mdb has all of the functions in a module together
with an AutoExec macro. The macro has a single step of RunCode where the
function is =DoExtract()

Public Function DoExtract()

Dim strCommand As String

strCommand = Command()

If StrComp(strCommand, "DoExtract", vbBinaryCompare) = 0 Then
' Code to do the extract
Else
' Wrong start code - so quit
Application.Quit
End If

End Function
The code could do whatever extraction was needed and then shut itself down.
The disadvantage of this is you need Access installed (and scheduled tasks
are often run from a server where this is not the case) and also the fact
that Access is a big program to start if all you need to do is extract a bit
of data.
You could create a vbs file which does it all without needing Access at all.
This has the advantage that you only need notepad to write it, but VBScript
suffers from being weakly-typed and offers quite limited error handling.
However, if you wrote it carefully, you would be OK. If you wanted the
advantage of a small program loading together with error handling you would
need something like Visual Basic to create an exe file.


Mar 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Steve | last post by:
Is there anyone with experience using the Winzip command line add-in? I can't get it to create the zip file with a space in the file name. Using: RetValue = Shell("C:\winzip\wzzip.exe...
4
by: Greg B | last post by:
Well since getopt() doesn't seem to be compatible with Windows, and the free implementation of it for Windows that I found still had some annoying restrictions, I thought I'd whip up a simple...
3
by: Billy Cormic | last post by:
Hello, I would like to write a windows application that can get the IP address of the computer the appliation is installed on. Then the program should ftp a file to another computer. I have no...
2
by: CP11 | last post by:
Newbie here. I am used to using vbscript but trying vb.net in vs2003. I am trying to add a button click event, like this: Dim LaunchApp As Integer LaunchApp = Shell("""c:\program...
6
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add...
9
by: Endless Story | last post by:
My last version of Python was 2.4, running smoothly on XP with path c: \Python24 - no need even to include this path in PATH; everything worked as it's supposed to at the command line. Just...
3
by: Tom Baxter | last post by:
I just set up VS 2008 B2 and did a simple command line compile from the VS command prompt. I received this warning: warning CS1668: Invalid search path 'C:\Program Files\Microsoft...
5
by: waltbrad | last post by:
Hi folks. I'm learning Python from the Mark Lutz Book, Programming Python 3rd edition. He seems to be able to invoke the Python interpreter from any command line prompt. C:\temp>python ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.