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

Tech: How to return a value to an external call?

First time post here ... I have been researching and not found info on
this.

One user here described the succinct way to call MS-Access and kick
off a command:
=====
Dim app As Access.Application

Set app = GetObject(, "Access.Application.8")
If Err.Number = 429 Then
Set app = CreateObject("Access.Application.8")
End If

app.docmd.beep

Set app = Nothing
=====

This works fine and I will substitute the main command with:

app.docmd.runmacro("myMacro")

The macro calls a function in a module and then quits the app.

The question here is:
How can a numeric value be returned to the calling vb program?
Does the VB code wait for a return value at all or do we need to
perhaps write a TXT file to pass this to the calling program?

I guess we will see, but does the VB program still run while the
Access object is doing it's data processing? or does the VB need to
run in a loop, continuously checking for the result file?

Thanks in advance for any help.
- Paul
Nov 12 '05 #1
3 2404
pd*****@bigfoot.com (Paul Drabik) wrote:
How can a numeric value be returned to the calling vb program?
Does the VB code wait for a return value at all
I don't ever recall seeing any way to set a return code for such a calling app.
Such may exist and I would welcome any such info.

Application.Quit exists but it has no return code. (At least not in A97) Neither
does DoCmd.Quit.
or do we need to
perhaps write a TXT file to pass this to the calling program?
Likely your best option.
I guess we will see, but does the VB program still run while the
Access object is doing it's data processing? or does the VB need to
run in a loop, continuously checking for the result file?


Both well run. So yes VB will need to run in a loop.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #2
Thanks so much for confirming what I suspected.
Now I need to nail down how to kick off the macro of the needed MDB file.

I know I can app.DoCmd.RunMacro("mymacro")
But how do I address the MDB that contains the macro?

I will be researching further.
- Paul

Tony Toews <tt****@telusplanet.net> wrote in message news:<u7********************************@4ax.com>. ..
pd*****@bigfoot.com (Paul Drabik) wrote:
How can a numeric value be returned to the calling vb program?
Does the VB code wait for a return value at all


I don't ever recall seeing any way to set a return code for such a calling app.
Such may exist and I would welcome any such info.

Application.Quit exists but it has no return code. (At least not in A97) Neither
does DoCmd.Quit.
or do we need to
perhaps write a TXT file to pass this to the calling program?


Likely your best option.
I guess we will see, but does the VB program still run while the
Access object is doing it's data processing? or does the VB need to
run in a loop, continuously checking for the result file?


Both well run. So yes VB will need to run in a loop.

Tony

Nov 12 '05 #3
pd*****@bigfoot.com (Paul Drabik) wrote:
Thanks so much for confirming what I suspected.
Now I need to nail down how to kick off the macro of the needed MDB file.

I know I can app.DoCmd.RunMacro("mymacro")
But how do I address the MDB that contains the macro?


Searching brings me a screen "Startup command-line options"

/x macro Starts Microsoft Access and runs the specified macro. Another way to
run a macro when you open a database is to use an AutoExec macro.

But you will need to use the Shell command to start Access which allows you to
specify command lines. Unfortunately this also means you must explicitly state the
path and file name of the appropriate msaccess.exe file. This is a Windows
limitation.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #4

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

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
0
by: Shekhar | last post by:
My ASP always calls a DLL that was constructed using VFP Code. If needed, this DLL can call a VFP External Class Method that is outside the DLL for some process. The DLL is bound with COM always. ...
3
by: Paul Drabik | last post by:
First time post here ... I have been researching and not found info on this. One user here described the succinct way to call MS-Access and kick off a command: ===== Dim app As...
16
by: G Patel | last post by:
Hi, If I want to call functions that don't return int without declaring them, will there be any harm? I only want to assign the function(return value) to the type that it returns, so I don't...
9
by: Angel | last post by:
Hi again, I'm trying to call functions from a proprietary DLL but it's turned out to be more difficult than I thought. I have this W32.DLL which was written in C by USPS. They don't provide the...
1
by: David | last post by:
Hi, I have a problem with returning a value from an external function..... My asp page is basically a list taken from a database. A date record is written from the DB, then all the...
4
by: Michele Petrazzo | last post by:
Hi, I want to execute an external code, that become from a text file (pe), call a function inside it and get its return value: # ext_code.txt def funct2Call(): return True # test.py
0
by: kowndinya | last post by:
hai When i call an external program using shell function, it is running succesfully what i need to do from the external program except the return value is zero hence i can't close that program. if ...
1
by: Calder Coalson | last post by:
I was searching for ways to get the return value from os.system() calls, when I came across this from 6 years ago. I tried what was suggested in this thread, but output =...
12
by: hectorchu | last post by:
Why doesn't my compiler (g++) flag something like this as an error: int main() { } ?
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.