View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Michel@toye.comeagain is offline
external usenet poster
 
Posts: 2
Default Running Access queries from Excel

Hello,

I don't know if I understand your question correctly, and I'm not familliar
with the code you are showing below.
I used connections from Excel to Access in the past by using Querydefs,
Recordsets or Tabledefs in VB.
When doing so you can create whatever SQL statement you want including
whatever parameters you'd like in a text string.
It's true that the " can be confusing when writing the code, but once
finished the user will never see this.

Michel


"smartchick" wrote:

I have an Excel sheet that I want to connect to several different Access
queries. A lot can be done automaticaly with importing data. What I want to
do is to add a parameter to the query that is being executed.

The VB code looks like this:
.CommandText = Array("SELECT * FROM `C:\PaycheckData`.`3-2CurBMProfile`")

I want to add CompanyID (which the user choose in the Excel doc.

The Queries have a bunch of " in them so sending the SQL in is hard, and I
don't want to do it like that either, because there are gonna be
non-programmer users using the document.