Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
job job is offline
external usenet poster
 
Posts: 65
Default Passing variable to Access

Perfect. Thanks!


"DM Unseen" wrote in message
ups.com...
Guys

Global variables are locked to their host application. So Excel can
never use VBA vairaibles from Access and vice versa. (COM) Automation
can only pass on information through procedure parameters.

So maybe do someting that uses a parameter to pass the filename from Xl
to Access.

example

Sub runaccess()
Set appAccess = CreateObject("Access.Applicati*on")
appAccess.OpenCurrentDatabase "C:\Projects\Payroll.mdb", False
'appAccess.Visible = False


appAccess.Run "ImportExport" , FileNme


Set appAccess = Nothing
End Sub


In Access it is running this code; Notice FileNme is what I want to
pass...


Sub ImportExport(strFilename as string )


Dim strFilter As String
Dim strInputFileName As String


DoCmd.SetWarnings False
DoCmd.OpenQuery "del_initial"


DoCmd.TransferText acImportFixed, "FGRODTA Import Specification", _
"FGRODTA_Initial", strFilename


DoCmd.TransferText acExportDelim, "FGRODTA_Initial Export
Specification", _
"FGRODTA_Initial", "C:\Projects\FGRODTA_Tab.txt"


DoCmd.OpenQuery "del_initial"


DoCmd.SetWarnings True


End Sub


BWT Excel can import and Export and convert text files as well, as long
it keeps within excel row limits. It is slightly lesss sophisticated as
Access though, esp on the older versions of XL.


DM Unseen


Reply
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
Import into Access from Excel, passing a variable for the field... [email protected] Excel Worksheet Functions 1 April 12th 07 09:44 AM
I Need VBA Assistance regarding passing a variable from Access Brent E Excel Programming 1 March 1st 05 08:16 PM
Passing variable to VarType of other Variable ExcelMonkey[_190_] Excel Programming 3 February 22nd 05 01:38 PM
Passing a variable between workbooks Rich Cooper Excel Programming 1 May 19th 04 07:27 PM
Passing variable from one sub to another Medemper Excel Programming 0 February 26th 04 10:23 PM


All times are GMT +1. The time now is 09:36 AM.

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

About Us

"It's about Microsoft Excel"