Update Query Table Using VBA

Jan 7, 2013

I'm trying to update a query table in excel, but it keeps giving me the error 1004

Worksheets("Data-All").Range("A4").QueryTable.Refresh BackgroundQuery:=False

Cell a4 is in my query table.

View 2 Replies


ADVERTISEMENT

Update SQL Query Rather Than ADD

Mar 2, 2010

This is to run stored procedures (in the SQL Database), and pass variables. But...once the query is setup...all I really want to do is change the variable...and "fix" the sql query with the new variable value.

Is there a better way than: ....

View 9 Replies View Related

Update Individual Query

Nov 21, 2006

Im using a spreadsheet with several third-party add-in queries using Showcase Strategy 4.5. The trouble I'm having is in writing a macro that will automatically refresh the queries. Currently I am using the line

application.run ("refreshdata")

however this refreshes all the queries and at several points I only need to refresh one or two. If anyone has any suggestions then I'd be very gratefull.

Also I feel the need to confess that I pilfered the above code from another forum and so I dont actually know how it works. VBA help doesnt seem to have anything relevant to say and I'd feel better knowing what the code I'm using actually does.

View 3 Replies View Related

Update Query Automatically

Dec 14, 2006

I have a form that laods when the workbook is opened. I also have an MS query that retrieves data from another source. When i open the workbook without the form loading i get a message asking if i want to update the query automatically. When i open the workbook with the form opening the message doesnt show until i close the form meaning i have no data in the sheet to use. Is there a way to get the query to refresh before the form opens?

View 2 Replies View Related

DB Query Refresh/Update Macro

Jun 16, 2008

I am trying to write a creative procedure that on workbook open will check the name of the worksheet if it includes the day's date in sheetname & if it doesn't rename the sheet & delete current region from A1, else exit the sub.

Then runs a query on an Access DB to place in the above worksheet.

I need this due to novice XL & DB (8)users.

This is what I have at the moment on a test DB courtesy of J Walkenbach's sample files .....

View 9 Replies View Related

Update Web Query Every X & Time Stamp

Aug 15, 2007

I've got a web query setup to poll a table detailing traffic information from my state's DOT page.

I have the web query set to update every 5 min.

I would like to save a particular cell from this query every 5 min and place a timestamp next to it.

Ultimately, I would like to build a table, one column = time, the other column = traffic data and have each row be 5 min apart.

View 9 Replies View Related

Update Screen After Data Query Refresh

Dec 18, 2006

I am bringing data in from an ODBC database, I am using ActiveSheet.QueryTables(1) and then .refresh.

I want to run a sub after the data has been brought in which finds the last row and adds a formula.

The problem I have is that the data brought in is not show on the screen until all of the macros are finished.

Is there a way of forcing the screen to update?, I have tried the recalculate and refreshall commands or is there another method I should be using?

Sub autofill()

Dim myobj As Object

If ActiveSheet.QueryTables.Count > 0 Then
Call clearscreen
Application.DisplayAlerts = False

Set myobj = ActiveSheet.QueryTables(1)

I require the data to be on the screen before I can find the last row used which is done in "addmaths"?

View 5 Replies View Related

Shorten This Query: If The Cell Doesnt Contain Any Info Dont Update

Apr 9, 2007

i have some code (see below). at the part where it says

If ActiveCell. Offset(0, 9).Value <> "" Then
.Fields("Skill_32") = ActiveCell.Offset(0, 9).Value

i want to make this smaller - i have to write this line bout 60 times 3 times over (incresing the numbers as i go ((0, 9..10..11 etc etc and (Skill_32..33..34 etc etc) )) to give you an idea of what im trying to accomplish - im opening and writing to a database but if the cell doesnt contain any info dont update.

Function EditCPS(ByVal StaffNumber As Long)
On Error Goto Err_Handler
Dim SkillsBuilderDB As Database
Dim RSSkillsBuilder As Recordset
Dim MySQL As String
Set SkillsBuilderDB = OpenDatabase(Worksheets("Adding Data").Range("IV1")) ' database location
MySQL = "select * from CPS where StaffNumber=" & StaffNumber
Set RSSkillsBuilder = SkillsBuilderDB.OpenRecordset(MySQL)
With RSSkillsBuilder
.Edit
If ActiveCell.Offset(0, 9).Value <> "" Then
.Fields("Skill_32") = ActiveCell.Offset(0, 9).Value
Else............................................

View 7 Replies View Related

Excel 2010 :: How To Auto Update PowerPoint Table When New Data Entered Into Table

Jun 12, 2013

I have created a table in Excel 2010 (pls see attached table named post.xlsx).

Then copied the above table into PowerPoint 2010, using "paste link" (I tried to attach the PowerPoint file but the system says "invalid file type" and I cannot attach it).

Question:

I have received income data for another month - the new month is 13 and the corresponding new income is 100.
I typed 13 and 100 into the Excel table post.xlsx and thus extended the table by another column.

Then I went back to PowerPoint slide, then right clicked on the table there, then clicked "update link".

Specific Question:

The newly-typed column in Excel table is not get updated in PowerPoint table.

View 2 Replies View Related

SQL Query From Table

Dec 6, 2008

How do I do a query from Excel table? I know that from sheet it works like SELECT * FROM [SheetName$], but how about a table?

View 9 Replies View Related

Pivot Table Query: Make A Pivot Table To Summarise The Data

Jan 22, 2007

attached is a spreadsheet 6 people in my area use daily(ive copied and pasted the sheet in question to a new worksheet, as the file was too big). Ive been trying for about 3 days now to make a pivot table to summarise this data.

View 6 Replies View Related

Query From 2 DSN's Into A Single Table

May 26, 2009

Our company's accounting system is physically split into 2 company databases, CompanyA and CompanyB. I'm trying to write a query which will pull the customer number and the accounts receivable balances from both companies into a single Excel table, for any customer with a total balance 0.

I have created the following query, which doesn't generate any errors, but is only successfully importing the data from the first company.

The CompanyA DSN is specified in the query ...

View 9 Replies View Related

Pivot Table Count Only 1 Query

Dec 5, 2008

the attachment is a sample spreadsheet of what i am trying to do. I would like to create a pivot table so that for each site I can list all of the organic suites individually. Then show a count of only 1 for each site, even when there are several counts for each site. And then for this to be related to a cost of each of the suites so that I can get a total cost for each site.

eg:

site name

organic suites suite cost
o1 x
o2 y
o3 z
Total A
etc

View 3 Replies View Related

Dynamically Created Tab As Table Name In SQL Query

Jun 8, 2014

I am having a excel vba code that copies tab from different excel file and then i want to use in sql query. It is always giving me error saying that "The Microsoft Access database engine could not find the object 'rahul'. Make sure the object exists and that you spell its name and the path name correctly. If 'rahul' is not a local object, check your network connection or contact the server administrator."

Though, when i rerun the macro after reopening the excel file, it is working fine. Seems like tabs dynamically created cant be used. Is their any way to get it done at runtime? I want to delete new created tab once data from new tab is inserted to required tab.

my macro calls first copyAllSheets(filename) and then writeSheet().

Code:

Private Function copyAllSheets(ByVal fname)
Dim destSheetCount As Integer
Const FUNCNAME = "copyAllSheets"
On Error GoTo ErrorHandler
Set wb = Workbooks.Open(fname)
destSheetCount = ThisWorkbook.Worksheets.Count + 1
wb.Worksheets("Buyer").Copy after:=ThisWorkbook.Sheets(1)
ThisWorkbook.Worksheets(destSheetCount).Name = "impBuyer"

[code]........

This is part of code so probably it wont be easy to understand the flow. but mainly i want to know how can i have newly created tab as table_name.

View 7 Replies View Related

VBA - Refresh Pivot Table & Query

Dec 1, 2009

I've used this code prior and it worked fine in Excel 2007, now I'm having issues with it. Originally every Pivottable & Query pointed to a different CSV file. Now I have two pivottables built off a Excel worksheet that is built from a Query. This allows me to do some complex lookups that I couldn't do with just the Pivottable and MS Query alone.

Here's the code that's failing out: Any problems with it in Excel 2007?

Private Sub Update_All_Data_Click()
Dim pvt As PivotTable
Dim ws As Worksheet
Dim qt As QueryTable

mytitle = "This will refresh all data for validation, are you sure?"
Msg = "The Refresh process takes about 5 minutes, are you sure you want to continue?"
Response = MsgBox(Msg, vbExclamation + vbYesNo, mytitle)
Select Case Response
Case Is = vbYes
' Do Nothing, continue with program
Case Is = vbNo
Worksheets("instructions").Range("a1").Select
End
End Select

For Each ws In ThisWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.BackgroundQuery = True
qt.Refresh
Next qt
Next ws

For Each ws In ActiveWorkbook.Worksheets
For Each pvt In ws.PivotTables
pvt.RefreshTable
Next pvt
Next ws

mytitle = "Confirmation of data refresh"
Msg = "The data has been refreshed"
Response = MsgBox(Msg, vbExclamation, mytitle)

End Sub

View 9 Replies View Related

Web Query - Select Table Not Being Captured

Jan 28, 2010

I'm trying to get the data from this site

http://www.cmegroup.com/clearport/pr...=1&PageStart=1

When going through the Web Query in Excel and pulling data with the above address. I get the option to pull the data from the products table..the table with the code/name/product group/sub group..etc etc...

But when I launch the query, it doesn't pull the table data..I get everything but the product list.

View 9 Replies View Related

Copy Data From Web Query To A Table

Jun 26, 2006

I use web query to get some range of data. This data is refresing and changing on some time (i set query refresh on 1 minute). So, i'd like to fetch this data and make the table with all data (new data on eg. every 1 minute). How to do this?
I use Excel 2003.

View 2 Replies View Related

HLOOKUP- Query To Populate A Table In My Spreadsheet

Aug 29, 2007

I run a web query to populate a table in my spreadsheet. The data is dynamic - and on some days, I will get a couple of extra rows in the table (its weather data, so e.g. when its raining, they will forecast an extra row of how many mm, etc...)

To give a simple example, right now I use Hlookup to locate the value of F3 (the date) in my dynamic range of B26:G26 and step down 3 rows, where my needed temperature values are for that corresponding day. This works great like this already: =HLOOKUP(F3,B26:G29,3,FALSE)

The big issue is...what happens if my target values are not always 3 rows down? If the query refreshes with any extra rows, this reference is shifted. (Well, my starting "Anchor" is shifted)

View 12 Replies View Related

Formatting Of Table When Importing Access Query

Mar 20, 2014

I have to import data into Excel from Access (yes, I have to import it to Excel and cannot use Access exclusively). When I import; however, the formatting does not come over correctly, most especially losing the formatting of numbers. I need one of two solutions:

1.) How to get the formatting to move over correctly?

2.) Or how I can save the formatting of a table, then be able to apply it as a "saved" format? The biggest thing is that the numbers will changed the number of decimal places and/or change from general numbers when I want to see them as currency.

The top table shows how i want this formatted, the bottom shows how it is importing.

View 2 Replies View Related

Make A Pivot Table In 2003 Based On This Query

Mar 16, 2009

I have an SQL Server that has a query (a view stored on the server) which takes roughly 10-20 seconds to execute. This execution time is the same in Excel 2007 if I import data to worksheet/pivottable. It is also the same in Excel 2003 while importing data into a worksheet. It returns about 350 rows.

However, if I try to make a pivot table in 2003 based on this query, it is much slower. I can set it up fine, but refreshing this pivot table takes at least 10-20x as long to complete, in the order of 5-20 minutes, to sometimes taking so long that I give up and kill it by hitting escape a bunch.

It's important to note that I am forced to used Microsoft Query to set up a pivot table in Excel 2003. There is no other way, I believe.

While it is running, Excel just sits there saying "Waiting for data to be returned from Microsoft Query".

Here is the weirdest part. Once the refresh starts, Microsoft Query loads in the background, you can see it on the taskbar. I believe that is expected behavior, but if I click on MS Query and view its datatable, I can see all the data is sitting there.

So what is the hold up? MS Query has the data. Excel is waiting for it to be returned. What is going on? And remember from above, if I do a simple import data to worksheet, MS Query is not used and everything is fast.

So my question is does anybody have any tips/advice on this issue? I need a way to not use MS Query for a pivottable's data source or I need a way to make MS Query not freeze up. I don't get why MS Query needs to be involved in the first place since I am not doing any parameters or so forth.

View 7 Replies View Related

Create Pivot Table Based On Union Query

Jul 2, 2010

I created a union query in Access to join two tables (Projections and Actual Sales). The query produces the results I want. I need to create a pivot table in Excel using the union query as the source. When I pull up the data import function in Excel, the union query does not appear. Do I need to do something else? I have tried to create a select query where I select all from the union query and I can find that fine.

When I use this query to create the pivot table the results end up all zeros when I try to sum the values. It creates some crazy results when I show it as count of also.

I can provide the data in either the Access database or Excel spreadsheet.

View 4 Replies View Related

Excel 2010 :: Pivot Table Filter Query

Feb 21, 2012

I have created a pivot table in Excel 2010 that lists amounts used of particular items each month. Inside the pivot table value field settings i have changed the show values as field so that it displays the difference in usage from this month to last.

However if i now select a top 10 filter it only filters by the total number used as opposed to the difference in usage from one month to the next (which is the values displayed).

Is there a way that i can filter by top 10 by the actual values displayed in the pivot chart and not just the underlying data that creates it?

View 4 Replies View Related

Create SQL Query In VBA And Display Result As Table In Worksheet

Feb 3, 2010

I need the VBA script in excel that will do a SQL Query, for this case I need to select a value where there are 2-3 tags and between certain period then display the result as a table in a worksheet.

Example I have a database with 3 types of tags "Tag A", "Tag B", and "Tag C", and each tag have a value with different timestamp. the database looks like this:

No. Timestamp Tags Value
1 1-Jan-2010 Tag A 18
2 1-Jan-2010 Tag C 20
3 2-Jan-2010 Tag A 20
4 3-Jan-2010 Tag B 17
5 3-Jan-2010 Tag C 19
6 4-Jan-2010 Tag B 18
7 4-Jan-2010 Tag A 20
8 5-Jan-2010 Tag A 22
9 5-Jan-2010 Tag B 18
10 5-JAn-2010 Tag C 20

View 9 Replies View Related

Avoid Query Table Continue Message On Refresh

Dec 15, 2007

I've used the code below and it's worked to stop Update Links message, but i still need one tip to avoid continue message that shows up after Update Links massage:

Private Sub Workbook_Open()
Application.AskToUpdateLinks = False
Sheets("Feb").Activate
Range("A200:I400").Select
Selection.QueryTable.Refresh BackgroundQuery:=True
End Sub

View 2 Replies View Related

Pivot Table :: The Query And External Data Source Is Disabled

Feb 5, 2007

In pivot table field Setting > Advanced > page field option, the selection for "the query and external data source is disabled. How do i enable it.

View 9 Replies View Related

Update Master Table

Jul 20, 2009

I'm new to Excel Macros and have hit a brick wall on what I would consider
to be my primary workhorse macro! I'm embarrassed to admit that I haven't
mastered coding for movement of data around the spreadsheet much beyond
the macro recorder. I need something tight, efficient, and (instructively commented)!

I've got a spreadsheet consisting of a Master table with 42 rows, (2 rows
per record), and 14 columns of information. To the left of that is another
table consisting of live data from the process. It has anywhere from 1 to
24 rows with 10 columns representing Current/Live/Pre-processed information,
pulled in from the company web location.

Both tables start with an indexing column of 2 character alphanumeric IDs.
They are as follows: C2, D3, D4, E3, E4, F3, F4, G3, G4, H3, H4, I2, I3,
I4, J2, J3, J4, K1, K2, K3, K4.

MASTER TABLE Index Column is B4 to B44 (2 rows per record, in A->Z order)
UPDATE TABLE Index Column is Y4 to Y24 (Could be from 1 to 21 rows (Max),
1 per record, normally in A-Z order.

What I need to do is Key on the Master index column for a particular ID,
against the UPDATE index column. When there's a match I need to take the
updated values from the UPDATE table and assign them to the appropriate
cells locations in the MASTER table.

Example:
Starting with ID "C2" in the MASTER table, check to see if "C2" exists in
the UPDATE Table Index. If there's a match the following cell value
transfers must occur. Z4 -> E4, AB4 -> J4, AC4 -> J5, AD4 -> H4,
AE4 -> K4 and AG4 -> I4. If "C2 is not found in the UPDATE Table then skip
to next ID, (D3).

If ID D3 is found, another cell value transfer must occur. Z5 -> E6,
AB5 -> J6, AC5 -> J7, AD5 -> H6, AE5 -> K6, and AG5 -> I6. If "D3 has no
updates then skip to next ID and so on. Continue checking IDs and updating
until all IDs have been checked.


I'm having difficulty crafting a macro to search 2 columns against one nother,
specify the correct ActiveCell, than offset appropriately to place the desired
value in the correct location.

View 10 Replies View Related

UserForm To Update A Table

Sep 11, 2013

I have a table recording details of attendees of courses. There are common and variable entries columns) for each attendee (row)

Common: Venue, Date, Teacher, Course.

Variable ( and specific to attendee): Role, Place of work,

So if there are 40 attendees then currently I have to enter the common fields for all attendees 40 times !!

Is there a way of having input boxes/ user form which asks for the common fields and then automatically updates the table?

View 3 Replies View Related

Can't Update Pivot Table

Jun 24, 2014

When I tried to Refresh the Pivot Table, the message I got was: The PivotTable field name is not valid. To create a PivotTable report, you must use data that is organized as a list with labeled columns. if you are changing the name of a PivotTable field, you must type a new name for the field. I did go in a check that all the columns are named though.

View 1 Replies View Related

Pivot Table Update

Sep 11, 2008

I've created a pivot table that summarizes sales and gross profit on a quarterly basis and YTD basis by Market and store. I have a drop down in my source data file which changes the month. I go to update the pivot table and it no longer recognizes the data fields because the headings change to the subsequent month. Is there a way to not have to recreate the pivot table every time a run a new period? See below. Once I run August and then refresh the data it will not recognize these fields any longer.

View 9 Replies View Related

Update Table Of Data

Dec 21, 2006

Cell A10 is set up to autocomplete based on the cells above it. Cells B10 and C10 are set up to use VLOOKUP to gather information from the table above based on the name in A10. What I would like is for C10 to autopopulate with the information in the table which corresponds to the name entered in A10, which it already does. What I would like to do after that is be able to change the data displayed in C10, and have it update in the cell in column C which corresponds to the name entered in A10. What I'm trying to do is create a customer manager. The customer's names will be hidden, as well as all their information, but I want my sales guys to be able to pull up an individual customer's information, then enter notes on that customer (column C). Vlookup won't allow you to enter information, as changing information erases the vlookup formula in the cell. This is very difficult to explain without direct visuals. Is there any way to do this?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved