LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default ADO SQL statment

I'm trying to modify the code below. I have an Excel sheet with Journal
Voucher data that I want to add to a table in an Access Database. Each line
in the spreadsheet will be a new record in the Access table.

The Journal Voucher data has 12 fields, (Cust Num, Doc, Unit, DR Acct, DR
BR, DR Amt, Cr Acct, CR BR, CR Amt, Descr, Vend Num, Date, Time). I have 3
questions:

(1) What is the correct syntax to add a new record to Access with mupltiple
fields (having trouble with the correct syntax)?

(2) Is there a way to do all of the lines at once instead of one at a time?

(3) Is this the way to go or is it better to start an Access application and
use the acimport command?

Dim Recordset As ADODB.Recordset
Set Recordset = New ADODB.Recordset

vDataBase = ActiveWorkbook.Sheets("Macros").Range("E6")
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '" &
vDataBase & "';Persist Security Info=False"

Dim r As Integer
r = 5

Do Until Len(Cells(r, 1)) = 0

Sql = "append [JV_Info] set [Customer Number] = '" & Cells(r, 1) & "'

Call Recordset.Open(Sql, ConnectionString, adOpenForwardOnly,
adLockReadOnly, CommandTypeEnum.adCmdText)

r = r + 1

Loop

Thanks for all of the help......Any suggestions or code on how to accomplish
this would be greatly appreciated.
--
JT
 
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
IF Statment Momo Excel Discussion (Misc queries) 2 December 7th 08 01:56 AM
IF Statment Momo Excel Worksheet Functions 2 December 6th 08 02:24 PM
Help with If statment pm Excel Discussion (Misc queries) 3 January 29th 08 04:09 PM
If statment if its possible. atb Excel Discussion (Misc queries) 2 October 17th 06 05:50 PM
If statment helpdesk genie Excel Worksheet Functions 2 January 12th 05 03:23 AM


All times are GMT +1. The time now is 03:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"