I also concur with you in being a minimalist in designs. But as I told you earlier, the results for different SQL queries should be placed (in other words the destination range) at different locations in the worksheet. That is why I am thinking of multiple QTs, each with a destination range of...
Yes, The access database will not globally placed. the path will depend on the location in which the user saves it. Getting the path to be automated is not a big problem. I can use "thisworkbook.path" to get the path in the user's system (computer).
But the catch is : The user should run the...
OK Skip, Let me give you an instance of the issue:-
Suppose I have created the report..and it is working fine in my system. The report is actually an excel spreadsheet(.xlsx). this rport uses an access database (database1.accdb).
Now suppose you are the user. I send you these two files- the...
Skip,
Yes I now understand your point. I have done accordingly and my report is working fine. Just wanted to let you know where I had gone wrong.
I know you had clearly stated in one of your previous posts that the code to CREATE the Query table should be run ONLY ONCE. I misunderstood this ...
Skip,
I am sorry for this but how do I "right click" on a QT. After assigning the name (say "q1") via code, I could find it in the name manager box (the name was changes to "q1_" though). But when I right clicked on this, nothing happened.
All I need to do is refresh this newly created QT...
Skip,
The reason for my duplication:-
Note that the parameter values are same in the two SQL Queries but the Table from which I am extracting are different. one is "data1" and the other is "data2". I know for this also one querytable is sufficient. BUT the main reason why I need two different...
Skip,
When I try to refresh the querytable using :-
ActiveSheet.QueryTables("qMyFirst").CommandText = "select values from data1 where ID=" & Range("B1") & "and na='" & Range("E1") & "'"
ActiveSheet.QueryTables("qMyFirst").Refresh
I am geting "Subscript out of range" error. My main aim is to...
Guys,
Thanks....My report is running now in 2010 environment.
I need to discuss one more thing with you guys. Hopefully if this is solved then I can go ahead and prepare my whole report.
The issue I am now facing is with the indices of the querytables. I know you had suggested that I delete...
Duane,
Thanks so much for this. I do understand the "good coding practices" that you showed. But I had tried similar code (before I saw your post) in the 2007 environment. I was getting an error-I don't know why. when I tried to debug, I saw the "yellow" line in the ".refresh backgroundquery...
Skip,
Thanks..This works fine. Really learnt a new thing!!
Sorry for this but one more thing : I have prepared the report in the compatible format (.mdb and .xls). Now I need to make the same thing in 2010 format (.accdb and .xlsm). I am sure the overall logic will be the same but there will...
Duane,
Yeah..I actually tried similar kind of manipulation but not with much luck. I want to create the query table only once and then refresh it to get the new results (depending on the SQL Query). Also the code should run in excel 2010.
Thanks for your help!!
Sayantan
No, that is not my intention. I want my automation to run in Excel 2010. Could you share some material(like a link to a website) that I can refer to solve my problem? Also it would be great if you could give me a heads start to solve this problem.
One thing : I think the work I did so far is of...
Yes..I was expecting this question. Actually I wanted to test run it in the compatible format. My assumption is that if it runs in the compatible format, then it will run fine in any environment. I might me wrong here...
Anyways, what do you suggest I should do in this case? I need this thing...
Hi Skip,
i am using excel 97-2003 format only. My excel file is saved as a .xls file.
One more thing : Previously I used sql.request for this project and the whole automation was running fine. The hitch is that sql.request is not supported in Excel 2010. So I am basically looking for an...
Hi,
I am relatively new to VBA coding. I want to extract data (by subsetting) from an access file and get the results in excel. After doing some research I have seen that using "querytables" in Excel VBA can do the trick. I have the following code :-
Sub test()
Dim a As String
Dim b As String...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.