LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 310
Default Access doesn't always close (Excel VBA) & passing parameters

Hello all!

I'm using Access 2003 and Excel 2000

(1) I'm trying to run an Access macro from Excel. The code I have works,
but Access doesn't always quit. Sometimes there's no problem. Other times I
can see the macro is done, but Access doesn't close. I have to click on
Excel which gives me an error message which i click "OK", and then closes
Access and everything runs as it should. This is the code that I currently
have.

Dim A As Access.Application

Set A = New Access.Application
A.Visible = True
A.OpenCurrentDatabase "G:\PC Reports New\PC Report.mdb"
A.DoCmd.RunMacro "Multiple Accounts Report"
A.CloseCurrentDatabase
A.Quit
Set A = Nothing
' more Excel VBA code that works properly

(2) On a related note, I've been scouring around looking to see if there's
any way to pass in parameters directly into the Access module. I have found
nothing useful. Currently Access starts from Excel and runs the macro which
only consists of the line RunCode LoopReport. Once LoopReport starts the
user has to input parameters that are then used for a make table query. It
would make my life easier if I could have the user input the parameters in
Excel and then pass them into Access. Something along the lines of
A.DoCmd.RunModule "LoopReport(x,y)"
to replace the line
A.DoCmd.RunMacro "Multiple Accounts Report"

LoopReport being the underlying module in the "Multiple Accounts Report"
macro and x,y being the parameters I want to pass from Excel to Access. It
appears there's no RunModule method though. Is there something else I can
use? Hopefully that all makes sense.

Any help would be much appreciated, particularly the first part. Thanks!

--
Cheers,
Michelle
"Anyone who says he can see through women is missing a lot." Groucho Marx
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query from Excel to Access - Passing Parameters? Marc T Excel Programming 8 February 4th 09 01:54 PM
Excel VBA Passing Parameters Through Cell Diana[_7_] Excel Programming 4 April 4th 07 05:53 AM
Passing Parameters to Word from Excel jake1729 Excel Programming 0 September 28th 05 12:47 AM
Passing parameters from excel to access Jabeen Excel Programming 2 April 5th 05 12:33 PM
Passing Excel Objects As Parameters MDW Excel Programming 0 September 17th 04 04:17 PM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"