Hi Experts,
I don't have a problem, but am just seeking advice.
Usually in my VBA procedures, when I need to run a query, I build an SQL string and then do a
This allows me to put in variables into my query string. You all know that. This usually involves declaring the variables, opening the db, assembling a few lines of string text, executing the SQL, closing the db. Typically about 9-15 lines of code.
Now if there is no need to plug in any variable values, I could set up an Access query and run the DoCmd.OpenQuery method in one line. I am tempted to do this in a few places, but I wanted to know if there are any pros & cons. I can see the reduction in LOC's, but is there any reason why I should not do this?
Thank you for sharing your wisdom,
Marvin M

I don't have a problem, but am just seeking advice.
Usually in my VBA procedures, when I need to run a query, I build an SQL string and then do a
Code:
db.Execute (strSQL)
Now if there is no need to plug in any variable values, I could set up an Access query and run the DoCmd.OpenQuery method in one line. I am tempted to do this in a few places, but I wanted to know if there are any pros & cons. I can see the reduction in LOC's, but is there any reason why I should not do this?
Thank you for sharing your wisdom,
Marvin M
