ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Ecell Use of an Access Table information (https://www.excelbanter.com/new-users-excel/191884-ecell-use-access-table-information.html)

Ray C

Ecell Use of an Access Table information
 
I have a a table in Access that holds some information that I need to use in
EXcell for the time being. Is it possible to have Excell work directly with
information held in an Access Table. I currently resolve the problem by
exporting the Table to Excell and then using Vlookup to access the data. This
means I have 2 versions of the same data and that is not good. it would be
good to do something like a lookup from within Excell but looking up
information held in an Access Table rather than another Spreadsheet.
Is this possible? Ammending the info in the Access table from within Excell
would be good but not neccessary.
Thanks RayC

Bob Phillips

Ecell Use of an Access Table information
 
Here is a starter


Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\bob.mdb"

sSQL = "SELECT * From Contacts"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
If Not oRS.EOF Then
ary = oRS.getrows
MsgBox ary(0, 0) & " " & ary(1, 0) & ", " & ary(2, 0)
Else
MsgBox "No records returned.", vbCritical
End If

oRS.Close
Set oRS = Nothing
End Sub



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ray C" wrote in message
...
I have a a table in Access that holds some information that I need to use
in
EXcell for the time being. Is it possible to have Excell work directly
with
information held in an Access Table. I currently resolve the problem by
exporting the Table to Excell and then using Vlookup to access the data.
This
means I have 2 versions of the same data and that is not good. it would be
good to do something like a lookup from within Excell but looking up
information held in an Access Table rather than another Spreadsheet.
Is this possible? Ammending the info in the Access table from within
Excell
would be good but not neccessary.
Thanks RayC




Ron de Bruin

Ecell Use of an Access Table information
 
Hi Ray

See also
http://www.rondebruin.nl/accessexcel.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ray C" wrote in message ...
I have a a table in Access that holds some information that I need to use in
EXcell for the time being. Is it possible to have Excell work directly with
information held in an Access Table. I currently resolve the problem by
exporting the Table to Excell and then using Vlookup to access the data. This
means I have 2 versions of the same data and that is not good. it would be
good to do something like a lookup from within Excell but looking up
information held in an Access Table rather than another Spreadsheet.
Is this possible? Ammending the info in the Access table from within Excell
would be good but not neccessary.
Thanks RayC


Ray C

Ecell Use of an Access Table information
 
Thamks Bob, this is great
Regards RayC

"Bob Phillips" wrote:

Here is a starter


Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\bob.mdb"

sSQL = "SELECT * From Contacts"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
If Not oRS.EOF Then
ary = oRS.getrows
MsgBox ary(0, 0) & " " & ary(1, 0) & ", " & ary(2, 0)
Else
MsgBox "No records returned.", vbCritical
End If

oRS.Close
Set oRS = Nothing
End Sub



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ray C" wrote in message
...
I have a a table in Access that holds some information that I need to use
in
EXcell for the time being. Is it possible to have Excell work directly
with
information held in an Access Table. I currently resolve the problem by
exporting the Table to Excell and then using Vlookup to access the data.
This
means I have 2 versions of the same data and that is not good. it would be
good to do something like a lookup from within Excell but looking up
information held in an Access Table rather than another Spreadsheet.
Is this possible? Ammending the info in the Access table from within
Excell
would be good but not neccessary.
Thanks RayC





Ray C

Ecell Use of an Access Table information
 
Thanks Ron, this is excelent
RayC

"Ron de Bruin" wrote:

Hi Ray

See also
http://www.rondebruin.nl/accessexcel.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ray C" wrote in message ...
I have a a table in Access that holds some information that I need to use in
EXcell for the time being. Is it possible to have Excell work directly with
information held in an Access Table. I currently resolve the problem by
exporting the Table to Excell and then using Vlookup to access the data. This
means I have 2 versions of the same data and that is not good. it would be
good to do something like a lookup from within Excell but looking up
information held in an Access Table rather than another Spreadsheet.
Is this possible? Ammending the info in the Access table from within Excell
would be good but not neccessary.
Thanks RayC




All times are GMT +1. The time now is 08:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com