Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how do i release an access database after importing into excell w.


--
Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default how do i release an access database after importing into excell w.

Need more info: How are you importing? How do you know Access is not being
"released"?

"PACS" wrote:


--
Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how do i release an access database after importing into excel

Below is the macro that was recorded. It is just an import data macro.
After running, if I try to open the access database I ge a read only error.
If I don't run the macro I do not get the read only errorr.


Sub get_part_info()
'
' get_part_info Macro
' Macro recorded 3/15/2005 by philliard
'
' Keyboard Shortcut: Ctrl+p
'
Sheets("ATR42 PARTMAST").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password=" """;User
ID=Admin;Data Source=C:\Documents and Settings\philliard\Desktop\parts
mst.mdb" _
, _
";Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System
database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Passwor" _
, _
"d="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking
Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transac" _
, _
"tions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create
System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don" _
, _
"'t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("ATR42 PARTMAST")
.Name = "parts mst"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"C:\Documents and Settings\philliard\Desktop\parts mst.mdb"
.Refresh BackgroundQuery:=False
End With
Sheets("MLG Side Bra Assbl CMM 32-18-09").Select
End Sub


"K Dales" wrote:

Need more info: How are you importing? How do you know Access is not being
"released"?

"PACS" wrote:


--
Paul

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default how do i release an access database after importing into excel

Is the Access database locked only as long as Excel stays open? That is, if
you shut Excel can you get back in Access with full read/write access? If
so, it is probably because Excel has set up the connection with record
locking (to prevent other users from changing the table while it works with
the data) and that it only releases the connection after you close the
workbook containing the querytable. This is the default behavior of a query,
but it can be : In the lines setting the various properties of the querytable
(i.e. after the "With
ActiveSheet.QueryTables.Add(....Destination:=Range ("A1"))") add one that says
..MaintainConnection = False.

The other thing you could consider is changing the part in the connection
string where it says "Mode=Share Deny Write", since this is where it is
denying other users the ability to write while it uses the table. It is
possible someone could change the underlying data just after you import it,
but if that is not a concern then there is no need to lock the table. But
unless it takes a long time for the query to run, it may not matter if you
lock the table as long as you release the connection as I described above.
As soon as the connection is dropped, any locks will also be released.

K Dales

"PACS" wrote:

Below is the macro that was recorded. It is just an import data macro.
After running, if I try to open the access database I ge a read only error.
If I don't run the macro I do not get the read only errorr.


Sub get_part_info()
'
' get_part_info Macro
' Macro recorded 3/15/2005 by philliard
'
' Keyboard Shortcut: Ctrl+p
'
Sheets("ATR42 PARTMAST").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password=" """;User
ID=Admin;Data Source=C:\Documents and Settings\philliard\Desktop\parts
mst.mdb" _
, _
";Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System
database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Passwor" _
, _
"d="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking
Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transac" _
, _
"tions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create
System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don" _
, _
"'t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("ATR42 PARTMAST")
.Name = "parts mst"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"C:\Documents and Settings\philliard\Desktop\parts mst.mdb"
.Refresh BackgroundQuery:=False
End With
Sheets("MLG Side Bra Assbl CMM 32-18-09").Select
End Sub


"K Dales" wrote:

Need more info: How are you importing? How do you know Access is not being
"released"?

"PACS" wrote:


--
Paul

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
Importing Access database into Excel 2007 confused_student Excel Discussion (Misc queries) 1 November 9th 09 10:02 PM
Importing data from excell to access. Tobes Excel Discussion (Misc queries) 2 November 14th 07 08:31 AM
Can you use VBA to query an Access database without importing data JonR Excel Programming 10 September 4th 07 02:00 AM
Importing from access database into multiple spreadsheets Sandy Excel Discussion (Misc queries) 1 September 8th 05 03:55 AM
Importing access database info into excel jwr Links and Linking in Excel 2 April 11th 05 02:13 PM


All times are GMT +1. The time now is 04:39 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"