Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default work with ADO or DAO


Hi,

I would like to realize with Excel by DAO or ADO two things:
The available tables of Excel should be updated by the tables i
Access.
Best of all simply overwrite.

Per table:
Either an available line should be updated by changes in Excel i
Access, or a new line be added.

More should not happen, actually. I hope that there is for this an eas
and quick solution.
Unfortunately, I cannot handle yet with ADO or DAO.
What is better ?

Who could help me there?

Many thanks already beforehand
Walke

--
walker00
-----------------------------------------------------------------------
walker002's Profile: http://www.excelforum.com/member.php...fo&userid=2591
View this thread: http://www.excelforum.com/showthread.php?threadid=39413

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default work with ADO or DAO

Hi Walker,

With ADO, You can test the following. Supposing you have Payroll in col A,
named myrange and Status in column B

'First make a reference via Tool/References .... To Microsoft ActiveX Data
Objects 2.x

Sub test()
Dim connMdb As ADODB.Connection
Dim recMdb As ADODB.Recordset
Dim strStatus As String

Set connMdb = New ADODB.Connection
Set recMdb = New ADODB.Recordset
"open a connection to the DB
connMdb.Open "Provider= Microsoft.Jet.OLEDB.4.0;" & "Data Source = " &
ThisWorkbook.Path & "\myDB.mdb;"

For Each cl In Range("MyRange")
'open the recordset corresponding to the payroll
recMdb.Open "Select Payroll, Status from STAFF ;", connMdb,
adOpenForwardOnly, adLockOptimistic
If recMdb.EOF = False Then
strStatus = recMdb.Fields("Status").Value
If cl.Offset(0, 1) < strStatus Then Debug.Print
recMdb.Fields("Payroll").Value & " " & recMdb.Fields("Status").Value
recMdb
Else : debug.print " No data for " & cl.value
End If
recMdb.Close
Next cl

connMdb.Close
Set recMdb = Nothing
Set connMdb = Nothing
End Sub

Regards

Jean-Yves

"walker002" wrote
in message ...

Hi,

I would like to realize with Excel by DAO or ADO two things:
The available tables of Excel should be updated by the tables in
Access.
Best of all simply overwrite.

Per table:
Either an available line should be updated by changes in Excel in
Access, or a new line be added.

More should not happen, actually. I hope that there is for this an easy
and quick solution.
Unfortunately, I cannot handle yet with ADO or DAO.
What is better ?

Who could help me there?

Many thanks already beforehand
Walker


--
walker002
------------------------------------------------------------------------
walker002's Profile:

http://www.excelforum.com/member.php...o&userid=25917
View this thread: http://www.excelforum.com/showthread...hreadid=394137



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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 02:38 AM.

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"