#1   Report Post  
Posted to microsoft.public.excel.misc
AT AT is offline
external usenet poster
 
Posts: 18
Default excel and access

Hi,

I am looking for a VBA way of connecting to aces via excel.
I want to click a button and data appears depending on what input I give
from and inputbox eg all data from table one that starts with name=fred.

My other thread on this was closed.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 140
Default excel and access

Hi at

The following site has some details and code snippets of common tasks in
excel/access

http://www.excelkb.com/?cNode=1I7C3V&pNodes=8M3M1M

Other Sites that I find usefull all the time
http://www.cpearson.com/excel/topic.aspx
http://www.j-walk.com/
http://www.mcgimpsey.com/index.html
http://www.mvps.org/dmcritchie/excel/excel.htm
http://www.rondebruin.nl/

HTH



"at" wrote:

Hi,

I am looking for a VBA way of connecting to aces via excel.
I want to click a button and data appears depending on what input I give
from and inputbox eg all data from table one that starts with name=fred.

My other thread on this was closed.

  #3   Report Post  
Posted to microsoft.public.excel.misc
AT AT is offline
external usenet poster
 
Posts: 18
Default excel and access


I found this code but I get an error when writing data to excel

Dim DBFullName As String
Dim TableName As String
Dim TargetRange As Range

DBFullName = "F:\accsess_ecel\db1.mdb"
TableName = "Table1"
Set TargetRange = Range("c1")

Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer
Set TargetRange = TargetRange.Cells(1, 1)
' open the database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
DBFullName & ";"
Set rs = New ADODB.Recordset
With rs
' open the recordset
.Open TableName, cn, adOpenStatic, adLockOptimistic, adCmdTable

' RS2WS rs, TargetRange ' write data from the recordset to the
worksheet
For intColIndex = 0 To rs.Fields.Count - 1 ' the field names
TargetRange.Offset(0, intColIndex).Value =
rs.Fields(intColIndex).Name
Next
TargetRange.Offset(1, 0).CopyFromRecordset rs ' error here

End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing

"steve_doc" wrote:

Hi at

The following site has some details and code snippets of common tasks in
excel/access

http://www.excelkb.com/?cNode=1I7C3V&pNodes=8M3M1M

Other Sites that I find usefull all the time
http://www.cpearson.com/excel/topic.aspx
http://www.j-walk.com/
http://www.mcgimpsey.com/index.html
http://www.mvps.org/dmcritchie/excel/excel.htm
http://www.rondebruin.nl/

HTH



"at" wrote:

Hi,

I am looking for a VBA way of connecting to aces via excel.
I want to click a button and data appears depending on what input I give
from and inputbox eg all data from table one that starts with name=fred.

My other thread on this was closed.

  #4   Report Post  
Posted to microsoft.public.excel.misc
AT AT is offline
external usenet poster
 
Posts: 18
Default excel and access

i found this but get an error

Dim DBFullName As String
Dim TableName As String
Dim TargetRange As Range

DBFullName = "F:\accsess_ecel\db1.mdb"
TableName = "Table1"
Set TargetRange = Range("c1")

Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer
Set TargetRange = TargetRange.Cells(1, 1)
' open the database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
DBFullName & ";"
Set rs = New ADODB.Recordset
With rs
' open the recordset
.Open TableName, cn, adOpenStatic, adLockOptimistic, adCmdTable

' RS2WS rs, TargetRange ' write data from the recordset to the
worksheet
For intColIndex = 0 To rs.Fields.Count - 1 ' the field names
TargetRange.Offset(0, intColIndex).Value =
rs.Fields(intColIndex).Name
Next
TargetRange.Offset(1, 0).CopyFromRecordset rs 'error

End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing


"steve_doc" wrote:

Hi at

The following site has some details and code snippets of common tasks in
excel/access

http://www.excelkb.com/?cNode=1I7C3V&pNodes=8M3M1M

Other Sites that I find usefull all the time
http://www.cpearson.com/excel/topic.aspx
http://www.j-walk.com/
http://www.mcgimpsey.com/index.html
http://www.mvps.org/dmcritchie/excel/excel.htm
http://www.rondebruin.nl/

HTH



"at" wrote:

Hi,

I am looking for a VBA way of connecting to aces via excel.
I want to click a button and data appears depending on what input I give
from and inputbox eg all data from table one that starts with name=fred.

My other thread on this was closed.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default excel and access

What error message or number, and if you press the [Debug] button, what line
of the code is hightlighted? Is it the line you have a 'error comment at the
end of?

"at" wrote:

i found this but get an error

Dim DBFullName As String
Dim TableName As String
Dim TargetRange As Range

DBFullName = "F:\accsess_ecel\db1.mdb"
TableName = "Table1"
Set TargetRange = Range("c1")

Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer
Set TargetRange = TargetRange.Cells(1, 1)
' open the database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
DBFullName & ";"
Set rs = New ADODB.Recordset
With rs
' open the recordset
.Open TableName, cn, adOpenStatic, adLockOptimistic, adCmdTable

' RS2WS rs, TargetRange ' write data from the recordset to the
worksheet
For intColIndex = 0 To rs.Fields.Count - 1 ' the field names
TargetRange.Offset(0, intColIndex).Value =
rs.Fields(intColIndex).Name
Next
TargetRange.Offset(1, 0).CopyFromRecordset rs 'error

End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing


"steve_doc" wrote:

Hi at

The following site has some details and code snippets of common tasks in
excel/access

http://www.excelkb.com/?cNode=1I7C3V&pNodes=8M3M1M

Other Sites that I find usefull all the time
http://www.cpearson.com/excel/topic.aspx
http://www.j-walk.com/
http://www.mcgimpsey.com/index.html
http://www.mvps.org/dmcritchie/excel/excel.htm
http://www.rondebruin.nl/

HTH



"at" wrote:

Hi,

I am looking for a VBA way of connecting to aces via excel.
I want to click a button and data appears depending on what input I give
from and inputbox eg all data from table one that starts with name=fred.

My other thread on this was closed.

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
Excel to Access JohnnyTheAmmer Excel Discussion (Misc queries) 2 June 16th 06 04:12 PM
Excel to Access (or something) aragno Excel Discussion (Misc queries) 2 March 21st 06 04:18 AM
Excel/Access slumert Excel Discussion (Misc queries) 0 February 1st 06 06:29 PM
Access Form In An Access Report (SubForm) Question Gary Links and Linking in Excel 0 January 27th 06 05:54 AM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM


All times are GMT +1. The time now is 07:15 AM.

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

About Us

"It's about Microsoft Excel"