Solved

Running an Access '97 report via dde

Posted on 1998-04-15
2
150 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi XE7 Rest Client 2 178
Display a PDF file and get words from it 6 96
Firewall issues 6 85
delphi exception 7 58
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now