Solved

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

Posted on 2009-07-15
3
882 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
[X]
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
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 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