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
Solved

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

Posted on 2009-07-15
3
874 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 - Microsoft MVP, Access and Data Platform) 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

860 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