LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Data Not populating in Access database from excel form


Hi All,

I am having an issue with my database. I connected my excel form to access
database using DAO which is not populating the access database.

Here is my code to connect to the access database.

Dim db As Database, rs As Recordset, r As Long
Set db = OpenDatabase("C:\Documents and Settings\My Documents\DemoDB")

Set rs = db.OpenRecordset("Demo_Table", dbOpenTable)

r = 3
Do While Len(Range("A" & r).Formula) 0

With rs
.AddNew

.Fields("Officer Name") = Range("A" & r).Value
.Fields("Officer Phone #") = Range("D" & r).Value
.Fields("Contact Person Name") = Range("E" & r).Value
.Fields("Contact Person Phone #") = Range("F" & r).Value
.Fields("Address") = Range("K" & r).Value
.Fields("City") = Range("L" & r).Value
.Fields("State") = Range("M" & r).Value
.Fields("Zip Code") = Range("N" & r).Value
.Fields("Special Instructions/Comments") = Range("P" & r).Value

.Update
End With
r = r + 1
Loop
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

This is my code to connect to the access database, Its not displaying any
error. Once I click "Submit" button on excel user form it just does nothing.
It does populate in excel sheet that I have, But not the Access database.

PLEASE HELP.

Thanks in Advance.
 
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 form populating in access 2002-03 but not 2007 sam Excel Programming 8 July 9th 09 03:41 AM
connect excel user form to access database sam Excel Programming 5 July 8th 09 04:09 PM
auto populate access database from an excel form sam Excel Programming 1 July 1st 09 09:09 PM
Excel template as form for data entry in Access database B. Ardolf Excel Discussion (Misc queries) 0 August 24th 07 04:00 PM
Error while populating a combobox from Access database shivboy[_13_] Excel Programming 1 June 29th 06 11:04 AM


All times are GMT +1. The time now is 07:18 PM.

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"