If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > saving excel info in access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-14-04, 08:22
Alexxx12 Alexxx12 is offline
Registered User
 
Join Date: Sep 2002
Location: NJ
Posts: 139
saving excel info in access

Hi:

win2k
excel & access 2k

I have users writing info into a sheet in excel and when clicking on the save button, I want to update an access db with that information. Is there a way I can open a db, write an sql to update that info and close the db from the excel save button?

Here is what I have so far, but that is imcomplete

Code:
Sub Update_data()
Dim MyCon As New Connection
MyCon.Open "C:\logcall\logcall.mdb"
Set rs = New Recordset
????
rs.Open "Update logcall_table set clientname = range("b1").value where clientname = 'alex'"
????
End Sub
I have also found that in Access:

Code:
sub Update_data()
dim db as database
dim qdf as QueryDef
dim strSQL as string
...
.
.
.
But that excel did not accept.

Is there a way to do this?
Reply With Quote
  #2 (permalink)  
Old 10-02-04, 10:58
n00bl0rd n00bl0rd is offline
Registered User
 
Join Date: Oct 2004
Posts: 8
add a reference to MS DAO 3.6 Object Library
the code to open a recordset is :

Code:
   Dim db As DAO.Database
   Dim rs As DAO.Recordset
   
   Set db = OpenDatabase("c:\db1.mdb")
   Set rs = db.OpenRecordset("table name")

   .......enter code to insert data here

   rs.close
   db.close
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On