Solved

Running an Access '97 report via dde

Posted on 1998-04-15
2
160 Views
Last Modified: 2010-04-06
I'm trying to run an access 97 report via dde. I'he put a TddeClientConv  component on the form and have set it for a a manual connect mode. (pressing a button fires it up)
Acceaa begins to run minimized, and i am in the right data base.But this is a far as I can go. I have setup another button to execute the macro (Iguess this is what I want) But nothing is executed , I could be using the wrong commands for acess; I'm not sure...anywhay here is a sample of the code:
procedure TForm1.Button1Click(Sender: TObject);
var
 zFileName,zParams,zDir:Array[0..79] of char;
 FileName:String;
begin
x.SetLink('C:\Program Files\Microsoft Office\Office\MSACCESS.EXE','d:\metro\suburban\wsscout\prod.mdb');
x.OpenLink;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
zFileName,zParams,zDir:Array[0..79] of char;
 FileName:String;
begin
filename:='"quit"';  // just tried something simple
StrpCopy(zFileName,FileName);
if x.ExecuteMacro(zfilename,true) then showMessage('ok')
 else
  showMessage('no'); // always comes up no
end;


What are the commands (macros ,Etc )to do this if possible ?

thanks
0
Comment
Question by:psutton
2 Comments
 
LVL 1

Accepted Solution

by:
AndersWP earned 300 total points
ID: 1361549
I would recommend using OLE automation instead. You could use a procedure somewhat like the following:

Uses
  Windows, ComObj;

Var
  Access: Variant;

begin
  Access:=CreateOleObject('Access.Application.8');
  Access.OpenCurrentDatabase('MyDB.mdb');
  Access.DoCmd.RunMacro('MyMacro');
  Access.Quit;
end;

Note that when using automation, you can directly access and manipulate all access objects, including reports, directly. You do not have to use a macro.

You can look in the Access 97 help file under "Application Object" for a description of the access automation object hierarchy.

You should be aware that using Access in this way will not exactly give you Roadrunner speed. Access is also a pig with memory, you will need at least 32MB to get a reasonable performance. I think this goes for using DDE as well.

I hope this will help you.

Greetings,
AndersWP
0
 

Author Comment

by:psutton
ID: 1361550
Thanks, it worked . Appreciate the help
paul Sutton
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question