Results 1 to 2 of 2

Thread: Access 2000 and Common Dialog Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    1

    Access 2000 and Common Dialog Control

    I am using Access 2000 to develop a DB application. All has been going very well, until i discover that i cant use the Common Dialog Control. The error i get is OLE Server isnt Registered - To Register re-install it

    Now from further investigation, i find that the required file comdlg32.ocx is no where to be found on my machine. This then led me to search for the file on the internet, which i dually found and registered on my machine, where i still got the same message the first time i tried to place the control onto one of my forms, then after that the message changed to one about not having the appropraite license.

    What i thought would resolve this little situation would be to install VB on this machine, but that leaves me to wonder will there be issues when it comes to deploying this app onto another machine??

    Surely there is another way around this, im really stuck here so any help is going to be very well received.

    Thanks
    M

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    This should give you a leg up..
    VB Code:
    1. Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (lpofn As OPENFILENAME) As Long
    2.  
    3. Public Const OFN_ALLOWMULTISELECT = &H200
    4. Public Const OFN_CREATEPROMPT = &H2000
    5. Public Const OFN_ENABLEHOOK = &H20
    6. Public Const OFN_ENABLESIZING = &H800000
    7. Public Const OFN_ENABLETEMPLATE = &H40
    8. Public Const OFN_ENABLETEMPLATEHANDLE = &H80
    9. Public Const OFN_EXPLORER = &H80000
    10. Public Const OFN_EXTENSIONDIFFERENT = &H400
    11. Public Const OFN_FILEMUSTEXIST = &H1000
    12. Public Const OFN_HIDEREADONLY = &H4
    13. Public Const OFN_LONGNAMES = &H200000
    14. Public Const OFN_NOCHANGEDIR = &H8
    15. Public Const OFN_NODEREFERENCELINKS = &H100000
    16. Public Const OFN_NOLONGNAMES = &H40000
    17. Public Const OFN_NONETWORKBUTTON = &H20000
    18. Public Const OFN_NOREADONLYRETURN = &H8000
    19. Public Const OFN_NOTESTFILECREATE = &H10000
    20. Public Const OFN_NOVALIDATE = &H100
    21. Public Const OFN_OVERWRITEPROMPT = &H2
    22. Public Const OFN_PATHMUSTEXIST = &H800
    23. Public Const OFN_READONLY = &H1
    24. Public Const OFN_SHAREAWARE = &H4000
    25. Public Const OFN_SHOWHELP = &H10
    26. Public Type OPENFILENAME
    27.      lStructSize As Long
    28.      hwndOwner As Long
    29.      hInstance As Long
    30.      lpstrFilter As String
    31.      lpstrCustomFilter As String
    32.      nMaxCustomFilter As Long
    33.      nFilterIndex As Long
    34.      lpstrFile As String
    35.      nMaxFile As Long
    36.      lpstrFileTitle As String
    37.      nMaxFileTitle As Long
    38.      lpstrInitialDir As String
    39.      lpstrTitle As String
    40.      Flags As Long
    41.      nFileOffset As Integer
    42.      nFileExtension As Integer
    43.      lpstrDefExt As String
    44.      lCustData As Long
    45.      lpfnHook As Long
    46.      lpTemplateName As String
    47. End Type
    48. Public Sub GetFileName(strfiletype)
    49.      ' Configure how the dialog box will look
    50.      With strFile
    51.           ' Size of the structure.
    52.           .lStructSize = Len(strFile)
    53.           ' Handle to window opening the dialog.
    54.           .hwndOwner = Application.hWndAccessApp
    55.           ' Handle to calling instance (not needed).
    56.           .hInstance = 0
    57.           ' File filters to make available: Dat Files
    58.           .lpstrFilter = strfiletype & " Files (*." & strfiletype & ")" & vbNullChar & "*." & strfiletype & vbNullChar
    59.           '.lpstrCustomFilter is ignored -- unused string
    60.           .nMaxCustomFilter = 0
    61.           ' Default filter is the first one (Dat Files, in this case).
    62.           .nFilterIndex = 1
    63.           ' No default filename.  Also make room for received
    64.           ' path and filename of the user's selection.
    65.           .lpstrFile = Space(256) & vbNullChar
    66.           .nMaxFile = Len(.lpstrFile)
    67.           ' Make room for filename of the user's selection.
    68.           .lpstrFileTitle = Space(256) & vbNullChar
    69.           .nMaxFileTitle = Len(.lpstrFileTitle)
    70.           ' Initial directory is C:\.
    71.           .lpstrInitialDir = "c:\" & vbNullChar
    72.           ' Title of file dialog.
    73.           .lpstrTitle = "Select a File" & vbNullChar
    74.           ' The path and file must exist; hide the read-only box.
    75.           .Flags = OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY
    76.           ' The rest of the options aren't needed.
    77.           .nFileOffset = 0
    78.           .nFileExtension = 0
    79.           '.lpstrDefExt is ignored -- unused string
    80.           .lCustData = 0
    81.           .lpfnHook = 0
    82.           '.lpTemplateName is ignored -- unused string
    83.      End With
    84.  
    85.      ' Display the dialog box.
    86.  
    87.      If GetOpenFileName(strFile) <> 0 Then
    88.           ' Remove null space from the file name.
    89.           strFilename = left(strFile.lpstrFile, InStr(strFile.lpstrFile, vbNullChar) - 1)
    90.      End If
    91. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width