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?
|