BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

New Access Query

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
D Whaley
Guest





PostPosted: Wed Jan 26, 2005 8:01 pm    Post subject: New Access Query Reply with quote



How do I create a new Query in Access using OLE.
If there is a way using ADO, I would prefer it.


Back to top
D Whaley
Guest





PostPosted: Thu Jan 27, 2005 9:39 pm    Post subject: Re: New Access Query Reply with quote



I figured it out using Com Objects, it could easily be done using Type
Libraries or Server Objects also.

In case anyone else could use this...

// Add ComObj & Variants to Uses
Procedure AddQueryToAccess(DBName, QueryName, QueryText: String);
var
Access: Variant;
begin
Access := CreateOleObject('Access.Application');
Access.OpenCurrentDatabase(DBName, False);
Access.CurrentDb.CreateQueryDef(QueryName, QueryText);
Access.Quit($00000001); // $00000001 = Save All Changes
End;

"D Whaley" <dwhaley (AT) hs-technologies (DOT) com> wrote

Quote:
How do I create a new Query in Access using OLE.
If there is a way using ADO, I would prefer it.





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.