VARIANT type for automatization (call MS Access 97 from MFC program) 
Author Message
 VARIANT type for automatization (call MS Access 97 from MFC program)

*** post for FREE via your newsreader at post.newsfeeds.com ***

Hi ALL !

Do anybody know, how make correct call of any Access 97 automatization
functions from MFC program ?

I made following:

ClassWizard -> Add class-> From a type lybrary-> Import from Type Library,
select file, Open.
Add  AfxOleInit () into InitInstance method;
Add #include <afxdisp.h>

Write code:

 IDoCmd cmd;
 if (!cmd.CreateDispatch("Access.Application.8"))
  AfxMessageBox("Server not Found");

Are these all correct ?

Next I, for example, write code of call:

 cmd.OpenReport(

But in arguments use VARIANT type (for name of report).

If I write in argument CString of simple "report1" as string constant, I get
a error. What can I write here ?

----------------------
WBR
Alexander Berezhnoy

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.*-*-*.com/ - The #1 Newsgroup Service in the World!
-----==  Over 90,000 Newsgroups - 16 Different Servers! =-----



Fri, 12 Dec 2003 17:14:45 GMT  
 VARIANT type for automatization (call MS Access 97 from MFC program)
Use
CString strName="your_name";
COleVariant variantName(str);
cmd.OpenReport(variantName);

Bye.
Marc.



Quote:
> *** post for FREE via your newsreader at post.newsfeeds.com ***

> Hi ALL !

> Do anybody know, how make correct call of any Access 97 automatization
> functions from MFC program ?

> I made following:

> ClassWizard -> Add class-> From a type lybrary-> Import from Type Library,
> select file, Open.
> Add  AfxOleInit () into InitInstance method;
> Add #include <afxdisp.h>

> Write code:

>  IDoCmd cmd;
>  if (!cmd.CreateDispatch("Access.Application.8"))
>   AfxMessageBox("Server not Found");

> Are these all correct ?

> Next I, for example, write code of call:

>  cmd.OpenReport(

> But in arguments use VARIANT type (for name of report).

> If I write in argument CString of simple "report1" as string constant, I
get
> a error. What can I write here ?

> ----------------------
> WBR
> Alexander Berezhnoy

> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 90,000 Newsgroups - 16 Different Servers! =-----



Sat, 13 Dec 2003 00:00:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Call MS Access 97 autotatization from MFC program

2. Does V5.0 MFC support MS Access '97

3. Is there a C/C++ library to access MS Access 97

4. The Cross-linking problem for MS Access 97

5. How I can handle photos in VC++5 and Ms Access 97 ???(URGENT)

6. How to import MS Access 97

7. Using VC++ 6.0 as an automation client to view and print reports from MS Access 97

8. ODBC MS Access 97 Login Failed?

9. How to import MS Access 97

10. How to import MS Access 97

11. MS Access 97 Reports in VC Application?

12. MS Word 97 OLE programming ...

 

 
Powered by phpBB® Forum Software