I am creating an excel spreadsheet from access where I build the query in the code behind using docmd.
Dim excelquery As String
Dim excelName As String
excelquery = "SELECT a,b, c FROM tableSql where a = 123"
excelName = "Excel_" & Month(Date) & Day(Date) & Year(Date) & ".xls"
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
I am creating the query in the afterUpdate event of the form. I am not sure how to save it as a query when I build it.
Rey Obrero (Capricorn1)
first create a query then save it.
is this query you are building will be the same but different criteria?
kw66722
ASKER
They query changes based on multiple fields on the form. There are many different combinations for the where statement.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Unlimited question asking, solutions, articles and more.
Rey Obrero (Capricorn1)
<Do you think I should delete the table when done?>
Yes you can, it is up to you.
but, like what i posted above, you can reuse the query by changing its definition.
Rey Obrero (Capricorn1)
btw, what access version are you using?
to enable DAO.Querydef, you have to add to your References the Microsoft DAO 3.6 Object Library
kw66722
ASKER
I am using access 2013. I thought about doing that but I wanted something that I could keep copying and not worrying about libraries not be available.