close

Hi,
I found this source code which creates a macro to store data from an excel
to access database. I need to modify it in such a way that i can store data
directly to an access database on a website. Also if i must log on to the
website before i can access the database, how can i put in the password and
user name so that it automatically logs on and stores information to the
database?

Source Code:

Sub DAOFromExcelToAccess()
' exports data from the active worksheet to a table in an Access database
' this procedure must be edited before use
Dim db As Database, rs As Recordset, r As Long
Set db = OpenDatabase(quot;C:\FolderName\DataBaseName.mdbquot;)
' open the database
Set rs = db.OpenRecordset(quot;TableNamequot;, dbOpenTable)
' get all records in a table
r = 3 ' the start row in the worksheet
Do While Len(Range(quot;Aquot; amp; r).Formula) gt; 0
' repeat until first empty cell in column A
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields(quot;FieldName1quot;) = Range(quot;Aquot; amp; r).Value
.Fields(quot;FieldName2quot;) = Range(quot;Bquot; amp; r).Value
.Fields(quot;FieldNameNquot;) = Range(quot;Cquot; amp; r).Value
' add more fields if necessary...
.Update ' stores the new record
End With
r = r 1 ' next row
Loop
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Sub--
help a friend help you

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()