Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Commondialog compile error at chr$(0) (Access 2000)

    I have some code that uses the Commondialog and has worked successfully in Access 97, 2000, and XP on Windows NT4.0 and 2000Pro. We have just updated some computers to Windows XP and I am getting an error when the code is ran using Access 2000, but not with Access XP. Here is my code:

    <code> <span style="background-color: #FFFF00; color: #000000; font-weight: bold">
    Public Function FileDialog(LoadSave As Boolean) As String</span hi>
    ' Calls the API File Dialog Window
    ' Returns full path to new File.
    ' If LoadSave = TRUE then call File Load Dialog

    On Error GoTo Err_fFileDialog

    ' Call the File Common Dialog Window
    Dim clsDialog As Object
    Dim strTemp As String
    Dim strfName As String

    Set clsDialog = New clsCommonDialog

    ' Fill in our structure
    ' I'll leave in how to select Jpeg to
    ' show you how to build the Filter
    clsDialog.Filter = "JPEG (*.JPG)" & <font color=4682b4>Chr$(0)</font color=4682b4> & "*.JPG" & Chr$(0)
    clsDialog.Filter = clsDialog.Filter & "Jpe (*.JPE)" & Chr$(0) & "*.JPE" & Chr$(0)
    clsDialog.Filter = clsDialog.Filter & "Jpeg (*.JPEG)" & Chr$(0) & "*.JPEG" & Chr$(0)
    clsDialog.Filter = clsDialog.Filter & "ALL (*.*)" & Chr$(0) & "*.*" & Chr$(0)

    'clsDialog.Filter = clsDialog.Filter & "Gif (*.GIF)" & Chr$(0) & "*.GIF" & Chr$(0)


    If LoadSave Then
    ' Display the Open File Dialog
    clsDialog.DialogTitle = "Please Select a JPEG File to Load"
    clsDialog.ShowOpen
    Else
    clsDialog.DialogTitle = "Please Enter/Select a FileName to save the JPEG File"
    clsDialog.ShowSave
    End If

    ' See if user clicked Cancel or even selected
    ' the very same file already selected
    strfName = clsDialog.FileName
    If Len(strfName & vbNullString) = 0 Then
    Set clsDialog = Nothing
    Exit Function
    '' Raise the exception
    ' Err.Raise vbObjectError + 513, "clsPrintToFit.fFileDialog", _
    ' "Please type in a Name for a New File"
    End If

    ' Return File Path and Name
    FileDialog = strfName
    ' Update our property
    m_CurrentJpegFileName = strfName

    Exit_fFileDialog:

    Err.Clear
    Set clsDialog = Nothing
    Exit Function

    Err_fFileDialog:
    FileDialog = ""
    m_CurrentJpegFileName = ""
    MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
    Resume Exit_fFileDialog

    End Function
    </code>

    Here is the error:
    <img src=/w3timages/blue3line.gif width=33% height=2>
    Compile error:
    Can't find project or library
    <img src=/w3timages/blue3line.gif width=33% height=2>

    When I go to debug, the first line of code is highlighted yellow, and the first <font color=blue>chr$(0)</font color=blue> is selected. I have no missing references. Any Idea's?

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Commondialog compile error at chr$(0) (Access 2000)

    Probably a missing reference. You will have to test on one of the problem machines - this cannot be solved on a machine where the database works OK.
    - Select Tools | References...
    - If you see references starting with MISSING, note which ones they are, then clear their check boxes.
    - Click OK.
    - See if you can compile the code (Debug | Compile <projectname>)

  3. #3
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Commondialog compile error at chr$(0) (Access 2000)

    Thanks Hans. I checked the references and the only one missing was for Outlook (which I didin't install on that machine), and I cleared the reference. It now works. Thanks!

Posting Permissions

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