Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Installing VB Component  at run-time version

Posted on 1997-11-15
2
Medium Priority
?
365 Views
Last Modified: 2012-06-22
Hello Access people!

I've racked my brains  trying to solve this problem and can't.  Maybe someone can help me. My work environment is Windows 95/Access 7.0. I created a form containing the Commondialog control using comdlg32.ocx,and evrything is working OK. then I made a run-time version using ADT. The setup wizard correctly added comdlg32.ocx to the registry file. However, at run-time this error message appears:  "There is no object in this control."  


What to do???

Ayelet Barnea
Kibbutz Saad
Israel
dev1@netvision.net.il
0
Comment
Question by:saad111597
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
hjack earned 400 total points
ID: 1959785
I've done the exact same thing...
you cannot use the common dialog ocx with version 7..
reason is: Access was further down the development cycle when the VB4 ocxes were standardized so they are not always compatible...
here's your options:
you have to use the MSAU7032.DLL (which is the commondialog equivalent for access 7...
here's the declaration--- (this declare function is from the Access 95 Developer's Handbook which I can't recommend enough)--
Declare Function glr_msauGetFileName Lib "MSAU7032.DLL" Alias "#1" _
 (gfni As glr_msauGetFileNameInfo, ByVal fOpen As Long) As Long
 

here's the wrapper function:

Function glrGetFileName(gfni As glr_msauGetFileNameInfo, ByVal fOpen As Boolean) As Long

    ' A wrapper function for glr_msauGetFileName() in MSAU7032.DLL.
    ' Unlike choosing a color, you are interested in several of the
    ' values coming back from glr_msauGetFileName, so it doesn't
    ' make sense to use optional parameters here: it's better to just
    ' pass in the structure, so you can retrieve whatever values you
    ' want from it once you're done.
    '
    ' From Microsoft Access 95 Developer's Handbook
    ' by Litwin, Getz, Gilbert and Reddick (Sybex)
    ' Copyright 1995.  All rights reserved.
   
    ' In:
    '     gfni: structure containing information about file to open/save
    '     fOpen: True = Open File, False = Save File
    ' Out:
    '     gfni: Filled with info about the chosen filename
    '     Return Value: glrErrSuccess (0) if successful, non-zero otherwise.

    Dim lngRetval As Long
    Dim strNull As String

    strNull = Chr$(0)
    ' Null terminate all the elements of the structure.
    With gfni
        .strFilter = RTrim$(.strFilter) & strNull
        .strCustomFilter = RTrim$(.strCustomFilter) & strNull
        .strFile = RTrim$(.strFile) & strNull
        .strFileTitle = RTrim$(.strFileTitle) & strNull
        .strInitialDir = RTrim$(.strInitialDir) & strNull
        .strTitle = RTrim$(.strTitle) & strNull
        .strDefExt = RTrim$(.strDefExt) & strNull
    End With
   
    lngRetval = glr_msauGetFileName(gfni, fOpen)

    With gfni
        .strFilter = glrTrimNull(.strFilter)
        .strCustomFilter = glrTrimNull(.strCustomFilter)
        .strFile = glrTrimNull(.strFile)
        .strFileTitle = glrTrimNull(.strFileTitle)
        .strInitialDir = glrTrimNull(.strInitialDir)
        .strTitle = glrTrimNull(.strTitle)
        .strDefExt = glrTrimNull(.strDefExt)
    End With
    glrGetFileName = lngRetval
End Function

the type def:

' ==== GetFileName ========================
Type glr_msauGetFileNameInfo
    hWndOwner As Long
    strFilter As String * 255
    strCustomFilter As String * 255
    lngFilterIndex As Long
    strFile As String * 255
    strFileTitle As String * 255
    strInitialDir As String * 255
    strTitle As String * 255
    lngFlags As Long
    lngFileOffset As Long
    lngFileExtension As Long
    strDefExt As String * 255
End Type

Public Const glrcOFN_READONLY = &H1
Public Const glrcOFN_OVERWRITEPROMPT = &H2
Public Const glrcOFN_HIDEREADONLY = &H4
Public Const glrcOFN_NOCHANGEDIR = &H8
Public Const glrcOFN_SHOWHELP = &H10
Public Const glrcOFN_NOVALIDATE = &H100
Public Const glrcOFN_ALLOWMULTISELECT = &H200
Public Const glrcOFN_EXTENSIONDIFFERENT = &H400
Public Const glrcOFN_PATHMUSTEXIST = &H800
Public Const glrcOFN_FILEMUSTEXIST = &H1000
Public Const glrcOFN_CREATEPROMPT = &H2000
Public Const glrcOFN_SHAREAWARE = &H4000
Public Const glrcOFN_NOREADONLYRETURN = &H8000
Public Const glrcOFN_NOTESTFILECREATE = &H10000
Public Const glrcOFN_NONETWORKBUTTON = &H20000
Public Const glrcOFN_NOLONGNAMES = &H40000


and my function call...

Function GetMyFileName() As String
    Dim gfni As glr_msauGetFileNameInfo

    gfni.strInitialDir = "C:\"
    gfni.strTitle = "Choose A File"
    gfni.hWndOwner = Application.hWndAccessApp
    ' Use filter 2 at startup.
    gfni.lngFilterIndex = 2
    gfni.lngFlags = glrcOFN_NONETWORKBUTTON
    gfni.strFilter = "XL files (*.xls)|" & _
     "*.xls|"
    ' Add an additional filter, leaving the original string intact.
    'gfni.strCustomFilter = "Text Files|*.txt|"
    If glrGetFileName(gfni, True) = 0 Then
        'MsgBox Trim(gfni.strFile)
        'if gfni.lngFlags And glrcOFN_READONLY Then
        '    MsgBox "You opened the file read-only!"
        'End If
    End If
    GetMyFileName = gfni.strFile
   
End Function

hope this helps...

I really do encourage you to check out their book ---
and I do not intend to break any copyrights by showing this code to you...

jack
jackl@menders.com
0
 

Author Comment

by:saad111597
ID: 1959786
Wow!!  It finally works. Thank you for your very, very useful advice.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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