LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel to SQL

Thanks, OfficeHacker. I have the issue solved - at least in testing it seems
to work fine so I hope I don't run into another glitch! jms

"OfficeHacker" wrote:

Hi Jani,

Transferring data from Excel to SQL Server via a linked Access table should
work (I've done it before) although I used an Access query (QueryDef object)
rather than opening the recordset.

Some things to look at:
- confirm your privileges on the SQL Server database for the table you are
trying to update. Confirm your account has read/write privileges.

- Don't use the OpenRecordset method on the query. This is an action query
(remember, you're appending). For this use the Execute method instead,
like this:

Dim dibs As DAO.Database
Dim qdf As DAO.QueryDef

Set dbs = CurrentDb()
Set qdf = dbs.QueryDefs("qryMyAppendQuery")

qdf.Parameters("Sent1") = Range("A" & r).Value
qdf.Parameters("Date1") = Range("B" & r).Value
'etc...

qdf.Execute

- There is no data validation. How do you guarantee that
".Fields("Date1") = Range("B" & r).Value" is being appended with a valid
date value. Passing incorrect data types will certainly generate an error.

 
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



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