QualifiedOpinion
New Member
- Joined
- Mar 16, 2012
- Messages
- 2
I am loomking for an alternative to MS Query. Currently I have three workbooks. Two of the workbooks reference the third wrokbook (DataBase). The DataBase file is a simple excel database that houses data with 100 rows and 125 columns of data. All files are saved on a corporate network server (I am not technical enought to knwo what kind of server). I built a query in excel to "pull" the data into a Replica Tab in each of the other workbooks so that the data can be referenced in the two main workbooks. The process to update the replica tabs is in an open event for each file (see below). I have a few problems. One is that two people can not work in a copy of either of the two files at the same time as it will not run the open even to update the repilca tab, it says that the DataBase file is already opened. The second problem I have is that suddenly the query seems to have disappeared or is altered ni some way. The disaperance or alteration has caused the open event to fail and its' failure causes excel to crash altogether with an Excel stopped working error (resolved by opening in safe mode and removing the Macro from the open event, but now will not update my replica tab). The third problem I have is that the DataBase file at times gets "hung" open out on the server. I then have to ask my colleagues to restart their PCs so that the path that they have open closes and the file can be accessed again. This hidden open path is not closed by merely closing excel but rather a complete reboot of the PC is required. I do not have a copy of Access and doubt my organization will provide one. Is there some alternative to these problems?
Sub Refresh_DB()
'
' Refresh_DataBase Macro
'
'
'Toggle hide/unhide the DB Replica sheet for the macro to run
'the DB Replica sheet needs to be hidden at the time of file opening/macro use
Application.ScreenUpdating = False
Dim wb As Workbook
Dim ShtNames() As Variant
Set wb = ActiveWorkbook
ShtNames = Array("DB_Replica")
For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i
wb.Activate
Sheets("DB_Replica").Select
ActiveWorkbook.RefreshAll
wb.Activate
Sheets("Input").Select
Range("A1").Select
Application.ScreenUpdating = False
For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i
'
End Sub
Sub Refresh_DB()
'
' Refresh_DataBase Macro
'
'
'Toggle hide/unhide the DB Replica sheet for the macro to run
'the DB Replica sheet needs to be hidden at the time of file opening/macro use
Application.ScreenUpdating = False
Dim wb As Workbook
Dim ShtNames() As Variant
Set wb = ActiveWorkbook
ShtNames = Array("DB_Replica")
For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i
wb.Activate
Sheets("DB_Replica").Select
ActiveWorkbook.RefreshAll
wb.Activate
Sheets("Input").Select
Range("A1").Select
Application.ScreenUpdating = False
For i = 0 To UBound(ShtNames)
wb.Sheets(ShtNames(i)).Visible = Not wb.Sheets(ShtNames(i)).Visible
Next i
'
End Sub