LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Exporting to access but no error message

I have created some code to export data from cells in excel to fields in
access. I attached the code to a button on a worksheet and it works fine.
Heres the code:
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strConnect As String, strSQL As String
Dim strJobNo As String

strJobNo = Cells(2, 2)
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Temp\temp.mdb;"
strSQL = "SELECT tblWIP.wpJobNo,tblWIP.wpJobCode, tblWIP.wpCost,
tblWIP.wpSales FROM tblWIP WHERE (((tblWIP.wpJobNo)= '" & strJobNo & "')); "

Set cnn = New ADODB.Connection
cnn.Open strConnect
Set rs = New ADODB.Recordset
rs.Open strSQL, cnn, adOpenDynamic, adLockOptimistic
'rs.AddNew
rs!wpSales = Cells(15, 3)
rs!wpCost = Cells(13, 2)
rs.Update
rs.Close
cnn.Close

The only time this does not work is when somebody is editing the particular
record in access, it just runs the code, does not update the database and
you get no errors. My question is what do I have to do to get an error
message in excel if somebody is editing the record in access.

Thanks In advance

Matt

 
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
File Error - Data May Be Lost message after Access export Northpaw22 Excel Discussion (Misc queries) 0 December 6th 05 10:06 PM
Error message in Excel after exporting Access query to Excel Romi Excel Discussion (Misc queries) 0 June 6th 05 02:53 PM
Error when exporting data into Access Laurent M Excel Programming 3 January 18th 05 09:01 AM
Programmatci Access to Vis Basic is not trusted error message KimberlyC Excel Programming 1 March 3rd 04 04:33 PM
Closing Excel error message from Access 2K Dave[_23_] Excel Programming 1 August 8th 03 10:54 AM


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