View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Automating MS Query

I'm not coding in VB, I'm using MS Query. When I built
the queries, I used the Get External Data/New Database
Query tool. Now when I want to edit the query, I right
click and say Edit Query. That's where I was trying to
edit the SQL code.

-----Original Message-----
It sounds like you are trying to do this in code rather

than manually as was
described.

In code, you wouldn't use a parameter query. You would

just use string
concatenation to put the appropriate value in the SQL

string.

Pseudo code:

sStr = "Select myTable.Field1 from MyTable Where

myTable.Field2 = " &
Worksheets("Sheet1").Range("A1").Value

--
Regards,
Tom Ogilvy

"Jen" wrote in

message
...
Thanks for the quick responses!

Unfortunately, neither of these ideas worked. When I
tried the ?, I got a syntax error message. When I tried
the [enter date] idea, I got "invalid column name 'enter
date'. I feel like I'm missing something stupidly
obvious. Any suggestions?


-----Original Message-----
Hello,

I have an Excel spreadsheet that uses MS Query to pull
data from a SQL database. Each month the user has to

go
in to each separate query (there are 12) to enter the
appropriate date range. I'm looking for ideas on how

to
automate this. Either have a pop-up box where they

enter
the date one time, or somehow have the queries refresh
with the most current month end. I need some ideas on
where to even begin. I know a little VBA, but only

from
recording my macros and then editing the code. I've

never
coded from scratch.

Any ideas would be great!

Thanks!
Jen
.



.