PC Review


Reply
Thread Tools Rate Thread

could someone look at my code please and tell me what's wrong? tha

 
 
=?Utf-8?B?QmxvbmRpZQ==?=
Guest
Posts: n/a
 
      12th Jan 2007
Sub RunAccessMacro()

Dim appAcc As Access.Application

'Opens Access or gets reference to app already running

Set appAcc = New Access.Application

'Optional to show or hide Access
appAcc.Visible = True

appAcc.OpenAccessProject
"P:\Analytic\Heather\Individual\IndividualTurnoverReport.mdb"

appAcc.DoCmd.RunMacro "Macro1: Get Data"
appAcc.DoCmd.RunMacro "Macro2: Create Report"

'Close Access
appAcc.Quit

'This will close Access, even w/o the 'Quit' command
Set appAcc = Nothing

End Sub
 
Reply With Quote
 
 
 
 
Norman Yuan
Guest
Posts: n/a
 
      12th Jan 2007
See comment inline.


"Blondie" <(E-Mail Removed)> wrote in message
news:76B89C82-4D90-42F0-B8A8-(E-Mail Removed)...
> Sub RunAccessMacro()
>
> Dim appAcc As Access.Application
>
> 'Opens Access or gets reference to app already running
>
> Set appAcc = New Access.Application
>
> 'Optional to show or hide Access
> appAcc.Visible = True
>
> appAcc.OpenAccessProject
> "P:\Analytic\Heather\Individual\IndividualTurnoverReport.mdb"



Application.OpenAccessProject() is used for opening Access project file
(*.adp), not *.mdb.

You should use

appAcc.OpenCurrentDatabase
"P:\Analytic\Heather\Individual\IndividualTurnoverReport.mdb"


>
> appAcc.DoCmd.RunMacro "Macro1: Get Data"
> appAcc.DoCmd.RunMacro "Macro2: Create Report"
>
> 'Close Access
> appAcc.Quit
>
> 'This will close Access, even w/o the 'Quit' command
> Set appAcc = Nothing
>
> End Sub



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wrong syntax when I try to set Javascript code in C# Code Behind. mesut Microsoft C# .NET 5 30th Jul 2008 10:22 AM
can some tell me what's wrong with this code? BRC Microsoft Access Form Coding 6 28th Jun 2007 11:19 PM
HREF ASP code problem - what's wrong with this code.... =?Utf-8?B?TWljaw==?= Microsoft Frontpage 3 14th Nov 2005 01:53 PM
Re: what is wrong with this code =?Utf-8?B?TWlrZQ==?= Microsoft ASP .NET 0 16th Sep 2004 09:13 PM
If IsNull Check Number Stop Code, What is wrong with this code ? Dave Elliott Microsoft Access Forms 1 21st Dec 2003 03:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 AM.