Solved

Unbound object frame problems

Posted on 2000-03-20
3
1,146 Views
Last Modified: 2012-05-04
I added an unbound object frame to one of my forms. I based it on an existing ms project 98 .mpp file.
i have a combobox cmbprograms. i want to update the unbound control source by what i choose from the combobox. in the on click event i called the next procedure:
Then I added the following procedure:
Private Sub UpdProjectSrc()
Dim rsProj As Recordset
On Error GoTo UpdProjectSrc_Err
cmbProject.SetFocus
Set rsProj = CurrentDb.OpenRecordset("Select WorkPlanFile from MppFiles where ProgramName='" & Me.cmbProject.Text & "'", _
                                     dbOpenSnapshot, dbReadOnly)
OLEUnbound0.Class = "Microsoft Project 8.0"  ' Set class name.
OLEUnbound0.OLETypeAllowed = acOLEEither   ' Specify type of object.
OLEUnbound0.SourceDoc = rsProj!WorkPlanFile ' Specify source file.
OLEUnbound0.SetFocus 'tried both with this option and with out it!!!
OLEUnbound0.Action = acOLEActivate 'acOLEUpdate ' acOLECreateEmbed 'update embedded object.
OLEUnbound0.SizeMode = acOLESizeZoom   ' Adjust control size.

UpdProjectSrc_End:
    If Not rsProj Is Nothing Then
        rsProj.close
        Set rsProj = Nothing
    End If
    Exit Sub
   
UpdProjectSrc_Err:
    MsgBox Err.Description & " " & Err.number & " " & Err.Source & Chr(13) _
                            & " Invalid Path"
    GoTo UpdProjectSrc_End
   
End Sub

the purpose was to update the unbound ctl with a program that is chosen in the cmbprograms combobox. when i use the acoleactivate in the .action i get the same source file (not the one i specified in the sourcedoc.) when i use acolecreateembed i get the following error:
*make sure the file is installed on your computer and that you used the correct filename.
*check the ole server documentation for info about syntax...
If i use the acoleupdate i get the next error:
the ole object isn't registered. the object may be calling an application that isn't registered. to register the application reinstall it.
can someone tell me how to update the source doc of the unbound control and immidiatly see the diffrent ms project file. on the form.
thank you very much.
0
Comment
Question by:ilanm
  • 2
3 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 2636896
' My demostration uses OLE Class Microsoft Excel 97
' MS Project is not installed to check

' Use the toolbox to create an Unbound object frame.
' the wizard displays the registered object types.
'you can create new object by selecting one of the displayed object types
' or create from an existing file and pick a file from supported types

' I assume name is OLE1
' set Object properties as:
' Enabled : YES
' Locked: NO
' OLE Type : Linked
' OLE Type Allowed : Either

' Assume  your comboBox = cmbprograms
' Row Source Type: Value list
' Row Source: "C:\file1.xls";"C:\file2.xls";"C:\file3.xls"

' In cmbprograms_afterupdate event have the folloing code:

Private Sub cmbprograms_AfterUpdate()
    OLE1.SourceDoc = cmbprograms
    OLE1.Action = acOLECreateLink
End Sub

' you will see the changes in the unbound object frame

' Make sure the files are present in proper location as specified in the cmbprograms row source.
0
 

Author Comment

by:ilanm
ID: 2639562
Hi hansr,
I moved the context of my procedure to the after change event of the combobox and it worked. the same code in diffrent place and it works. it is probably a microsoft 98 bug.
please lock the question so i can grade you. thank you very much.
0
 
LVL 30

Accepted Solution

by:
hnasr earned 200 total points
ID: 2640186
ilanm,

Glad to help and thanks.  Proposing answer as suggested.

' My demostration uses OLE Class Microsoft Excel 97
' MS Project is not installed to check

' Use the toolbox to create an Unbound object frame.
' the wizard displays the registered object types.
'you can create new object by selecting one of the displayed object types
' or create from an existing file and pick a file from supported types

' I assume name is OLE1
' set Object properties as:
' Enabled : YES
' Locked: NO
' OLE Type : Linked
' OLE Type Allowed : Either

' Assume  your comboBox = cmbprograms
' Row Source Type: Value list
' Row Source: "C:\file1.xls";"C:\file2.xls";"C:\file3.xls"

' In cmbprograms_afterupdate event have the folloing code:

Private Sub cmbprograms_AfterUpdate()
    OLE1.SourceDoc = cmbprograms
    OLE1.Action = acOLECreateLink
End Sub

' you will see the changes in the unbound object frame

' Make sure the files are present in proper location as specified in the cmbprograms row source.

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sum Multiple Columns in Access Query 5 48
combine ShipTo and BillTo Address 3 22
Change AD password via MS Access DB 2 17
Restrict list data depending upon user name 3 20
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now