PC Review


Reply
Thread Tools Rate Thread

Code execution has been interrupted

 
 
ryan.fitzpatrick3@safeway.com
Guest
Posts: n/a
 
      6th Dec 2007
What does Code execution has been interrupted mean.

Here is my code.

Sub Access_Data()

' Access_Query

Dim conn As New ADODB.Connection
Dim rst As ADODB.Recordset
Dim strPath As String

strPath = "C:\Documents and Settings\rfitz03\Desktop\RYAN'S EXCEL
SHEETS\Strategic Sourcing\Forms\Position Sheet\flour.mdb"

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strPath & ";"
conn.CursorLocation = adUseClient

' Create a Recordset from all the records
' in the Products table

Set rst = conn.Execute(CommandText:="MonthlyReceivings", _
Options:=adCmdTable)

' begin with the first record
rst.MoveFirst
' transfer the data to Excel
' get the names of fields first
With Worksheets("Pulled from Access").Range("A6")
.CurrentRegion.Clear
For j = 0 To rst.Fields.Count - 1
.Offset(0, j) = rst.Fields(j).Name
Next j
.Offset(1, 0).CopyFromRecordset rst
' .Offset(1, 0).CopyFromRecordset rst, 5
' .Offset(1, 0).CopyFromRecordset rst, , 2
(--->) .CurrentRegion.Columns.AutoFit ( <-----------------)
Problem with code here.
End With
rst.Close
conn.Close
End Sub



This code has worked great in the past, except when I changed the
access table to another table it now doesn't want to work. Can someone
help?

Ryan
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      6th Dec 2007
Try rebooting your computer.
--
HTH...

Jim Thomlinson


"(E-Mail Removed)" wrote:

> What does Code execution has been interrupted mean.
>
> Here is my code.
>
> Sub Access_Data()
>
> ' Access_Query
>
> Dim conn As New ADODB.Connection
> Dim rst As ADODB.Recordset
> Dim strPath As String
>
> strPath = "C:\Documents and Settings\rfitz03\Desktop\RYAN'S EXCEL
> SHEETS\Strategic Sourcing\Forms\Position Sheet\flour.mdb"
>
> conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
> & "Data Source=" & strPath & ";"
> conn.CursorLocation = adUseClient
>
> ' Create a Recordset from all the records
> ' in the Products table
>
> Set rst = conn.Execute(CommandText:="MonthlyReceivings", _
> Options:=adCmdTable)
>
> ' begin with the first record
> rst.MoveFirst
> ' transfer the data to Excel
> ' get the names of fields first
> With Worksheets("Pulled from Access").Range("A6")
> .CurrentRegion.Clear
> For j = 0 To rst.Fields.Count - 1
> .Offset(0, j) = rst.Fields(j).Name
> Next j
> .Offset(1, 0).CopyFromRecordset rst
> ' .Offset(1, 0).CopyFromRecordset rst, 5
> ' .Offset(1, 0).CopyFromRecordset rst, , 2
> (--->) .CurrentRegion.Columns.AutoFit ( <-----------------)
> Problem with code here.
> End With
> rst.Close
> conn.Close
> End Sub
>
>
>
> This code has worked great in the past, except when I changed the
> access table to another table it now doesn't want to work. Can someone
> help?
>
> Ryan
>

 
Reply With Quote
 
ryan.fitzpatrick3@safeway.com
Guest
Posts: n/a
 
      6th Dec 2007
On Dec 6, 9:06 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com> wrote:
> Try rebooting your computer.
> --
> HTH...
>
> Jim Thomlinson
>
> "ryan.fitzpatri...@safeway.com" wrote:
> > What does Code execution has been interrupted mean.

>
> > Here is my code.

>
> > Sub Access_Data()

>
> > ' Access_Query

>
> > Dim conn As New ADODB.Connection
> > Dim rst As ADODB.Recordset
> > Dim strPath As String

>
> > strPath = "C:\Documents and Settings\rfitz03\Desktop\RYAN'S EXCEL
> > SHEETS\Strategic Sourcing\Forms\Position Sheet\flour.mdb"

>
> > conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
> > & "Data Source=" & strPath & ";"
> > conn.CursorLocation = adUseClient

>
> > ' Create a Recordset from all the records
> > ' in the Products table

>
> > Set rst = conn.Execute(CommandText:="MonthlyReceivings", _
> > Options:=adCmdTable)

>
> > ' begin with the first record
> > rst.MoveFirst
> > ' transfer the data to Excel
> > ' get the names of fields first
> > With Worksheets("Pulled from Access").Range("A6")
> > .CurrentRegion.Clear
> > For j = 0 To rst.Fields.Count - 1
> > .Offset(0, j) = rst.Fields(j).Name
> > Next j
> > .Offset(1, 0).CopyFromRecordset rst
> > ' .Offset(1, 0).CopyFromRecordset rst, 5
> > ' .Offset(1, 0).CopyFromRecordset rst, , 2
> > (--->) .CurrentRegion.Columns.AutoFit ( <-----------------)
> > Problem with code here.
> > End With
> > rst.Close
> > conn.Close
> > End Sub

>
> > This code has worked great in the past, except when I changed the
> > access table to another table it now doesn't want to work. Can someone
> > help?

>
> > Ryan


Yup that worked. any ideas why that happens or it just does sometimes?
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      6th Dec 2007
It gets mad because you changed without telling it you were going to.

"(E-Mail Removed)" wrote:

> On Dec 6, 9:06 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
> This-.com> wrote:
> > Try rebooting your computer.
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> > "ryan.fitzpatri...@safeway.com" wrote:
> > > What does Code execution has been interrupted mean.

> >
> > > Here is my code.

> >
> > > Sub Access_Data()

> >
> > > ' Access_Query

> >
> > > Dim conn As New ADODB.Connection
> > > Dim rst As ADODB.Recordset
> > > Dim strPath As String

> >
> > > strPath = "C:\Documents and Settings\rfitz03\Desktop\RYAN'S EXCEL
> > > SHEETS\Strategic Sourcing\Forms\Position Sheet\flour.mdb"

> >
> > > conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
> > > & "Data Source=" & strPath & ";"
> > > conn.CursorLocation = adUseClient

> >
> > > ' Create a Recordset from all the records
> > > ' in the Products table

> >
> > > Set rst = conn.Execute(CommandText:="MonthlyReceivings", _
> > > Options:=adCmdTable)

> >
> > > ' begin with the first record
> > > rst.MoveFirst
> > > ' transfer the data to Excel
> > > ' get the names of fields first
> > > With Worksheets("Pulled from Access").Range("A6")
> > > .CurrentRegion.Clear
> > > For j = 0 To rst.Fields.Count - 1
> > > .Offset(0, j) = rst.Fields(j).Name
> > > Next j
> > > .Offset(1, 0).CopyFromRecordset rst
> > > ' .Offset(1, 0).CopyFromRecordset rst, 5
> > > ' .Offset(1, 0).CopyFromRecordset rst, , 2
> > > (--->) .CurrentRegion.Columns.AutoFit ( <-----------------)
> > > Problem with code here.
> > > End With
> > > rst.Close
> > > conn.Close
> > > End Sub

> >
> > > This code has worked great in the past, except when I changed the
> > > access table to another table it now doesn't want to work. Can someone
> > > help?

> >
> > > Ryan

>
> Yup that worked. any ideas why that happens or it just does sometimes?
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Execution has been interrupted Hydra Microsoft Excel Programming 10 9th Nov 2009 02:05 PM
Code execution has been interrupted =?Utf-8?B?QkFD?= Microsoft Excel Programming 0 12th Feb 2007 09:59 PM
Code Execution Has Been Interrupted LCK Microsoft Excel Programming 2 18th Nov 2005 12:25 AM
Code Execution Interrupted Jim Palmer Microsoft Excel Misc 0 15th Nov 2004 10:58 PM
Code Execution Interrupted Jim Palmer Microsoft Excel Misc 0 15th Nov 2004 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 PM.