Link to home
Start Free TrialLog in
Avatar of dawber39
dawber39Flag for United States of America

asked on

Old Access App

I've got a database created in Access 97 which just runs a bunch of action queries, I have brought it up to 2013 with what I know, but I still face one difficulty. The application which is designed to split off a database at a specified date to avoid overgrowth and archive previous years is functioning well at this point except for the button that is supposed to open up the navigation dialogue to locate the database i. It gives the error in the attached image. Same thing happens if I try to run the Code through a Macro. If I try stepping through the "Function SplitDirBtn()" I get the attached compile error – and the code is below.

Any input is appreciated.
RD

Function SplitDirBtn()
' Called from Forms!Settings!SplitDirBtn
Const PROCNAME = "SplitDirBtn"
Dim TblSpec As String, sPath As String, sAppName As String
Dim iPos As Integer, i As Integer
Dim f As Form
On Error GoTo SplitDirBtn_Err
   Set f = Forms!Settings

  'TblSpec = GetAccdbName()
   TblSpec = FindMyAccdb("")
  'Debug.Print "TblSpec=" & TblSpec & "]" & Len(TblSpec)

   iPos = InStr(TblSpec, "CLERKTBL.ACCDB")
   If iPos < 4 Then
      Beep
     'MsgBox "Accdb file not selected", 48, PROCNAME
      Exit Function
   End If
   sPath = Left$(Trim$(TblSpec), iPos = 2)
   sPath = Mid$(TblSpec, 1, iPos - 2)
   sPath = Proper(sPath)

   f!SplitDir = sPath

   For i = 1 To Len(sPath)
      If Mid$(sPath, i, 1) = "\" Then iPos = i
   Next
   f!PublicDir = Left$(sPath, iPos - 1)

SplitDirBtn_Exit:
   On Error Resume Next
   Exit Function
SplitDirBtn_Err:
   Beep
   MsgBox Error & " Err# " & Err, 16, PROCNAME
   Resume SplitDirBtn_Exit
End Function

Private Function StringFromSz(szTmp As String) As String
'  If string terminates with nulls, return a truncated string.
Dim ich As Integer, sTmp As String
   szTmp = Trim$(szTmp)
   ich = InStr(szTmp, Chr$(0))
   If ich <> 0 Then
      sTmp = Mid$(szTmp, 1, ich - 1)
   Else
      sTmp = szTmp
   End If
  'Debug.Print "ich=" & ich & " sTmp=" & sTmp & "]" & Len(sTmp)
   StringFromSz = sTmp
   If Len(sTmp) > 100 Then
      ' Breakpoint
   End If
End Function

Open in new window

Error.png
Error2.png
Avatar of dawber39
dawber39
Flag of United States of America image

ASKER

This is the highlighted line with the compile error - so I think i  am missing a reference

Private Function GetAccdbName2(gfni As wlib_GetFileNameInfo, ByVal fOpen As Integer) As Long
SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you know where I can get the 11.0 object library to use that code?
You don't need the 11 lib (that's 2007).   Just look for the current object lib, which for you should be 13.0.

The dialog is still part of Office.

Jim.
That would be 15.0 - but its still not functioning correctly. Maybe a manual ref to 15.0
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As always - Experts up here either get me there or point me in the right direction. You people are awesome