Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Programming to go between Access and Excel

Is it possible to write code (in Excel's Visual Basic)
that accesses an Access database and deletes all current
records? I want all of this to happen when the user hits
a button that says "update".

What I am trying to accomplish is to download the
existing data out of Access, edit the data in Excel,
remove the old records in Access and import the updated
records from Excel. The only part I can't figure out is
how to delete the existing records in Access so that I
don't have duplicate enrties when I upload the refrshed
data from Excel.

Can anyone help? I'd be so grateful!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Programming to go between Access and Excel

Is it possible to write code (in Excel's Visual Basic)
that accesses an Access database and deletes all current
records? I want all of this to happen when the user hits
a button that says "update".


Sub macro1()
' Microsoft DAO x.x Object Library at menu
' Tools | References must be checked
Dim rs As Recordset
Dim db As Database

Set db = OpenDatabase("c:\path\filename.mdb")
Set rs = db.OpenRecordset("Table1")
Do
rs.Delete
rs.MoveNext
Loop Until rs.EOF
Set rs = Nothing
Set db = Nothing
End Sub

HTH,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Programming to go between Access and Excel

Thanks so much for the information. When you wrote
Tools/ References must be checked, is that in Excel? Is
it under Tools? Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Programming to go between Access and Excel

Shin,

In the VBA editor, go to the Tools menu, choose References, and in that
dialog check the appropriate item in the list box.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Shin" wrote in message
...
Thanks so much for the information. When you wrote
Tools/ References must be checked, is that in Excel? Is
it under Tools? Thanks



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
how i can do programming in MS Excel.? Vishvapal Excel Worksheet Functions 1 February 13th 07 01:18 PM
ADO programming in Excel-VBA CLamar Excel Discussion (Misc queries) 1 May 31st 06 02:45 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
Excel Programming in VB Jean-Paul Viel Excel Programming 1 September 10th 03 12:13 PM
Excel Programming in VB Peter Atherton Excel Programming 2 September 9th 03 12:40 PM


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