Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View Excel In Access

Status
Not open for further replies.

sgfromny

Technical User
Jan 17, 2003
120
0
0
US
I'd like the ability to view an Excel Spreadsheet in an Access Form - Using a field on the form to indicate the filename of the xl Document.. Is this possible? If so, How?
 
You will need an unbound OLE control and some code:

Code:
Private Sub Form_Current()
If Not IsNull(Me.FileFullPath) Then
Me.OLEUnboundName.Visible = True
Me.OLEUnboundName.SourceDoc = Me.FileFullPath
Me.OLEUnboundName.OLETypeAllowed = acOLELinked
Me.OLEUnboundName.Action = acOLECreateLink
Else
Me.OLEUnboundName.Visible = False
End If
End Sub
 
Thanks for the help -

I do get this error though:
- Can't perform the operation specified in the Action Property of the visual basic procedure you're trying to run.

Any Ideas why?
 
Have you an Unbound Object Frame with the following properties:

[tt]OLEClass : Microsoft Excel 2000
DisplayType : Content
UpdateOptions : Automatic
OLEType : Linked
OLETypeAllowed : Linked
Class : Excel.Sheet.8[/tt]
 
OLEClass : Microsoft Excel 2003
DisplayType : Content
UpdateOptions : Automatic
OLEType : embedded
OLETypeAllowed : Linked
Class : Excel.Sheet.8


 
Yes - Actually by Default Enabled was NO and Locked was Yes.
Changed them to Yes and No respectively and Still get an error:

Cant Link the OLE Object or the bound or Unbound Object Frame

 
And you have changed this line:
Me.OLEUnboundName.SourceDoc = Me.FileFullPath

To reference a textbox containing the full path to an excel file?

It may be worth testing with the name of a file, rather than a textbox.
 
Yes - Actually I have it set to a variable first
xlFile = "S:\Proposal\"& me.document & ".xls"
me.OLEUnboundName.SourceDoc = xlFile

Ive checked the filename and its correct..
 
Try inserting this before the action:

OLEUnboundName.SourceItem = "R1C1:R5C5"

OLEUnboundName - you have changed this to the name of your unbound control, have you not?
 
Yes but Still trouble - For simpilicty I named my control to OLEUnboundName
 
Are your references ok? Can you see the Excel file that you used in creating the unbound control?
 
If I create the Control from an XL file I can see the Spreadsheet, when I assign a new file to the control, it fails.
 
I surprised you hung on for as long as you did - Many Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top