Solved

"Compile error: User-defined type not defined" - adh_accOfficeGetFileNameInfo

Posted on 2009-07-15
3
859 Views
Last Modified: 2013-11-27
Borrowing code from a Access DB I developed some time back, I'm trying to allow users to select the directory where the file for import resides.  In my old DB, it still works fine.  However, in my new DB, I get a COMPILE ERROR (included in the title).  I have gone through and verified References, and all are identical in both DBs.  Can anyone tell me why, when I try to DIM a variable, adh_accOfficeGetFileNameInfo will not show as one of my choices, while it does in my old DB?  And a recommended course of action?  Any assistance would be greatly appreciated.  Thanks in advance.
Public Function gfni_getFile()

Dim gfni As adh_accOfficeGetFileNameInfo

With gfni

    .hwndOwner = Application.hWndAccessApp

    .strAppName = "Select Location of File for Import"

    .strDlgTitle = "Select Location of File For Import"

    .strOpenTitle = "Select"

    .strfile = "*.mdb"

    .strInitialDir = "\\server\directory\folder"

    .strFilter = "Access Database (*.mdb)|All Files (*.*)|Excel Spreadsheet (*.xls)"

    .lngFilterIndex = 1

    .lngView = adhcGfniViewList

    .lngFlags = adhcGfniNoChangeDir Or adhcGfniInitializeView

End With
 

If adhOfficeGetFileName(gfni, True) = adhcAccErrSuccess Then

    gfni_getMTOE = Trim(gfni.strfile)

End If

End Function

Open in new window

0
Comment
Question by:tebert0411
  • 2
3 Comments
 
LVL 75
ID: 24861094
You are missing part of the code from Getz's app ... mainly the part the defines

adh_accOfficeGetFileNameInfo

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 24861109
That  code goes in the Declaration section of a standard vba module, along with several other similar declarations related to the file browse.

mx
0
 

Author Closing Comment

by:tebert0411
ID: 31603827
Thanks for the reminder.  As stated previously, I've been out of the mix for a while.  Forgot all about the declarations.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

706 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

18 Experts available now in Live!

Get 1:1 Help Now