Results 1 to 7 of 7
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Compile Error User Defined Type (Access 2003)

    I have the following code in two applications running on the same computer.

    Private Sub cmdAddPicture_Click()
    ' Use the Office File Open dialog to get the picture file name.
    Dim FileName As String
    Dim Dlg As New CommonDialog

    path = CurrentProject.path

    With Dlg
    .FileName = "*.jpg"
    .... etc.

    It runs in one application, but when I added it to a new application I keep getting a Compile Error: " User defined type not defined." at the line "Dim Dlg as New CommonDialog"

    Any suggestions as to what I'm missing here?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Compile Error User Defined Type (Access 2003)

    Is it references?

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile Error User Defined Type (Access 2003)

    Sorry, but I don't understand your reference to "references." What references are you referring to (if you'll pardon the pun)?

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

    Re: Compile Error User Defined Type (Access 2003)

    Pat meant Tools | References... in the Visual Basic Editor.

    CommonDialog is not part of the Access or Office object library. I would use the FileDialog object. Look it up in the online help for an example.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Compile Error User Defined Type (Access 2003)

    Good one (pun that is), what I meant was to check if there are any missing references.

    And have you checked all the references required for the common dialog (just guessing here).

  6. #6
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile Error User Defined Type (Access 2003)

    I checked the references in the app that runs and selected all the same refs in the app that doesn't run. It still doesn't run!!!

    I'll follow up on Han's suggestion and see if I can make any sense of this problem.

  7. #7
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile Error User Defined Type (Access 2003)

    I discovered that I had to have a Module (CommonDialog) installed in the db for the function to work.

Posting Permissions

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