Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refreshing data from a linked *.dbf database file without opening it. Ahrder Links and Linking in Excel 0 February 27th 09 04:12 AM
Refreshing database query in Excel nc Excel Discussion (Misc queries) 2 October 13th 08 07:44 PM
saving and refreshing workbook linked to a SQL database Texas Tonie[_2_] Excel Discussion (Misc queries) 0 November 9th 07 11:03 PM
Refreshing a linked Access Database Rob Excel Discussion (Misc queries) 0 October 17th 07 12:40 AM
database query not showing foxpro database How I import data mangat New Users to Excel 1 June 24th 07 03:31 PM


All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"