Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

library Utility with XP

Status
Not open for further replies.

DeSn

Programmer
Nov 20, 2001
111
BE
Hi,

I have a MS Access application that runs fine with MS Access 97, but now that I've converted it to MS Access 2002 on my XP I get the following error:

Don't know the user-defined type: wlib_GetFileNameInfo.
I've check some things and that type comes from the library Utility (utility.mda in program files\MS Office\office).

Does anyone has a clue on how to solve this?
 
Many times those values are just enumerated constants. Can you go back to your old code and see what it actually did or what value the constant held? Perhaps just substituting the constant value will make it work or help you find the new enumeration equivalent.

Also, the Object Browser is a useful tool for these types of things.

Here is an example from Outlook:

'From Outlook olAttachmentType Enumeration
Private Const olByReference = 4
Private Const olByValue = 1
Private Const olEmbeddeditem = 5
Private Const olOLE = 6

Good Luck!


Have a great day!

j2consulting@yahoo.com
 
It isn't a constant (i think) but a type (like String is).
This is the code:

Private Function ODX_GetMDBName2(gfni As wlib_GetFileNameInfo, ByVal fOpen As Integer) As Long
' This function acts as a cover to MSAU_GetFileName in MSAU200.DLL.
' wlib_GetFileName terminates all strings in gfni structure with nulls and
' then calls DLL version of function. Upon returning from MSAU200.DLL, null
' characters are removed from strings in gfni.

Dim lRet As Long

gfni.szFilter = RTrim$(gfni.szFilter) & Chr$(0)
gfni.szCustomFilter = RTrim$(gfni.szCustomFilter) & Chr$(0)
gfni.szFile = RTrim$(gfni.szFile) & Chr$(0)
gfni.szFileTitle = RTrim$(gfni.szFileTitle) & Chr$(0)
gfni.szInitialDir = RTrim$(gfni.szInitialDir) & Chr$(0)
gfni.szTitle = RTrim$(gfni.szTitle) & Chr$(0)
gfni.szDefExt = RTrim$(gfni.szDefExt) & Chr$(0)

lRet = wlib_MSAU_GetFileName(gfni, fOpen)

gfni.szFilter = ODX_StringFromSz(gfni.szFilter)
gfni.szCustomFilter = ODX_StringFromSz(gfni.szCustomFilter)
gfni.szFile = ODX_StringFromSz(gfni.szFile)
gfni.szFileTitle = ODX_StringFromSz(gfni.szFileTitle)
gfni.szInitialDir = ODX_StringFromSz(gfni.szInitialDir)
gfni.szTitle = ODX_StringFromSz(gfni.szTitle)
gfni.szDefExt = ODX_StringFromSz(gfni.szDefExt)

ODX_GetMDBName2 = lRet


End Function

PS I have no idea what the function does... my job is just to make it work in XP.
 
Maybe you just need to set a reference to this library since it is not native to Office. Go into an Access97 VB editor and select Tools, References and see if something like that is in the list. If it is, click on it and note the path and file name and add it into your new one if it is missing.

Otherwise, it sounds like the object browser might be your best bet. If you've never used it, go into Access97 VB editor and hit F2. Then search for wlib_ and see what you find.

Good LucK!

Have a great day!

j2consulting@yahoo.com
 
I've checked the reference already and i both version it is there. I've used the object browser to and i've seen that the type isn't present, but what do i do about it :(

I gess there have to be difference in the to utility-file but i can't open the modules of the utility-DB so i've can't check for differences... pfffffffffff
 
What does it look like in Access97? It looks like maybe it is just a wrapper for a DLL call. If it shows up in Access97 you could create your own Struct in XP to match it and pass it in like below:

Private Structure TestStructure
szFilter As String
szCustomFilter As String
szFile As String
szFileTitle As String
szInitialDir As String
szTitle As String
szDefExt As String
End Structure

Sub Test
Dim lngX As Long
Dim tsTest As TestStructure
ts.szFilter = "Something"
ts.szCustomFilter = "Something"
lngX = ODX_GetMDBName2(tsTest, 0)
End Sub

Good Luck!



Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top