Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Open Access Macro, then put a value into a parameter field

Hello All,

I can't figure out how to put data from excel into a 'parameter' field once
an access macro has been called from excel.

In Access, a small userform appears with the title "Enter Parameter Value".

I can get the Access macro to start, but can't figure out how to do the
rest. I tried sendkeys but that didn't work. Please see my code so far...

Private Sub cmdveerpqr_Click()

'<<< Opens the OPM Database and opens the 'Open PQR' macro

Dim LPath As String

'<<< Procedure to copy the "SSN" field data

txtveerappssn.SelStart = 0
txtveerappssn.SelLength = txtveerappssn.TextLength
txtveerappssn.Copy


'<<< Back to the database

LPath = "\\afilepath\another\opm_XP.mdb"

Set oApp = CreateObject("Access.Application")
oApp.Visible = True

oApp.OpenCurrentDatabase LPath

oApp.DoCmd.RunMacro "Open PQR"

***This is where I'm stumped, and I know sendkeys is the most unpreffered
way of getting this to work, but I thought to give it a shot.

Application.SendKeys "^v"

End Sub


Any help would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Open Access Macro, then put a value into a parameter field

You don't need to open Access. You can do it in the background using
DAO or ADO. For example:

Dim db As DAO.Database
Dim rs As Recordset
Dim qdf As QueryDef

Set qdf = db.QueryDefs("Query1")
qdf("ID") = 101
Set rs = qdf.OpenRecordset

For the above to work, Microsoft DAO x.xx Object Library must be
checked using the VBE menu Tools | References. For more info, see
he
http://www.erlandsendata.no/english/...php?t=envbadac

Hth,
Merjet


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
Need Macro to Open Access Launchnet Excel Worksheet Functions 9 June 22nd 07 03:57 PM
Open Excel using Access macro No Name Excel Programming 2 March 7th 06 04:18 PM
Macro Password to open or access Param Excel Worksheet Functions 0 March 6th 06 04:24 PM
Workbook Open macro/& Pivot Table Calculated field query Jeff Standen Excel Programming 0 May 4th 04 04:48 PM
Workbook Open macro/& Pivot Table Calculated field query Bob Phillips[_6_] Excel Programming 0 May 4th 04 04:00 PM


All times are GMT +1. The time now is 05:03 PM.

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"