By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,751 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Help on Databases in VBA for VB and SQL illiterate

P: 4
Hi,
Need some desperate help.
I am trying to grab some data from a database and throw it onto my Excel sheet followed by some manipulation. Earlier I thought I can just set up a query once and then refresh the data each time I run the macro, so I added the following two lines to my macro:
Sheets("BoardUsage").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
("BoardUsage" is the name of the worksheet where I pasted the data the first time I ran the query)
But now, when I refresh the data, the data is incorrect somehow. So I was wondering whether I need to run the original query each time? And if so can I add a code for that in VBA so that I get the exact fields that I need along with the search criteria I had the first time? Can someone help me with this?

(Sorry guys, I am VB and SQL illiterate and am used to recording macros)

Thanks in advance.
Apr 8 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.