![]() |
Refreshing a database query
Hi all ,
i am not too good at vba but i have a command button that activates to refresh a database query frm other worksheets then refresh a pivot table(data is from query) follow by doing a Calculate The database query always encounter 1 problem My database query cant refresh after i press it for second time. its like the table is copied onto the sheet and cannot be refresh. Anyone can highlight me the problemes? thanks below my code for the command button. Private Sub RefData_Click() Sheets("BalancePO").Activate Selection.QueryTable.Refresh BackgroundQuery:=False Sheets("POTable").Activate Set pvtTable = Worksheets("POTable").Range("A1").PivotTable pvtTable.SourceData = "Database" pvtTable.RefreshTable Sheets("EL2 Summary").Activate Range("C19").Select Application.MaxChange = 0.001 ActiveWorkbook.PrecisionAsDisplayed = False Calculate Calculate End Sub |
Refreshing a database query
Are you sure the refreshed table is named database and database includes the
entire table? -- Regards, Tom Ogilvy "SeeKY" wrote in message ... Hi all , i am not too good at vba but i have a command button that activates to refresh a database query frm other worksheets then refresh a pivot table(data is from query) follow by doing a Calculate The database query always encounter 1 problem My database query cant refresh after i press it for second time. its like the table is copied onto the sheet and cannot be refresh. Anyone can highlight me the problemes? thanks below my code for the command button. Private Sub RefData_Click() Sheets("BalancePO").Activate Selection.QueryTable.Refresh BackgroundQuery:=False Sheets("POTable").Activate Set pvtTable = Worksheets("POTable").Range("A1").PivotTable pvtTable.SourceData = "Database" pvtTable.RefreshTable Sheets("EL2 Summary").Activate Range("C19").Select Application.MaxChange = 0.001 ActiveWorkbook.PrecisionAsDisplayed = False Calculate Calculate End Sub |
Refreshing a database query
i define the name "Database"
its the range of the query table. Database=OFFSET(BalancePO!$A$1,0,0,COUNTA(BalanceP O!$A:$A),7) "Tom Ogilvy" wrote: Are you sure the refreshed table is named database and database includes the entire table? -- Regards, Tom Ogilvy "SeeKY" wrote in message ... Hi all , i am not too good at vba but i have a command button that activates to refresh a database query frm other worksheets then refresh a pivot table(data is from query) follow by doing a Calculate The database query always encounter 1 problem My database query cant refresh after i press it for second time. its like the table is copied onto the sheet and cannot be refresh. Anyone can highlight me the problemes? thanks below my code for the command button. Private Sub RefData_Click() Sheets("BalancePO").Activate Selection.QueryTable.Refresh BackgroundQuery:=False Sheets("POTable").Activate Set pvtTable = Worksheets("POTable").Range("A1").PivotTable pvtTable.SourceData = "Database" pvtTable.RefreshTable Sheets("EL2 Summary").Activate Range("C19").Select Application.MaxChange = 0.001 ActiveWorkbook.PrecisionAsDisplayed = False Calculate Calculate End Sub |
All times are GMT +1. The time now is 04:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com