Results 1 to 13 of 13
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Get just the name of the file and not the full path

    If I used currentdb.name



    I get the full path and the file name.

    I want only the file name not the full path.

    Is there a separate property for that??

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Not that I am aware of. It is simple enough to extract from the full path with string manipulation functions.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Not that I am aware of. It is simple enough to extract from the full path with string manipulation functions.

    yeah I am using

    Code:
    'gets the name of the file and makes it skip to staff and not admin if missing "A" character on frontend file title
    Dim sFullPath As String
    Dim sFullFilename As String
    Dim sFilename As String
    
    
    sFullPath = CurrentDb.Name
    sFullFilename = Right(sFullPath, Len(sFullPath) - InStrRev(sFullPath, "\"))
    sFilename = Left(sFullFilename, (InStr(sFullFilename, ".") - 1))
    
    
    If sFilename <> "DatabaseFrontEndA" Then
    DoCmd.OpenForm "frmSplashscreen"
    DoCmd.Close acForm, "frmOPEN"
    Exit Sub
    End If
    Question - can you de-reference a library from VBA? I have runtime users which if the outlook library is checked then they can't use the database (get a nice error) so I would like to disable it before the runtime users load...

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Bing: Access vba unselect library reference

    See if this helps.
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=272
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Bing: Access vba unselect library reference

    See if this helps.
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=272

    It sort of does but that is for excel - I need to uncheck the reference for the access database (probably currentDB?)

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Couldn't hurt to try the adaptation.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Couldn't hurt to try the adaptation.

    I didn't get anywhere.

    I tried

    http://www.access-programmers.co.uk/...ad.php?t=92526

    however because it is runtime I have to do the check before everything else starts to avoid the problem.

    (This is what I am trying to avoid-Click image for larger version. 

Name:	Capture.jpg 
Views:	11 
Size:	68.1 KB 
ID:	15545 )

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    ok hoping something like this will work

    Private Sub Form_Open(Cancel As Integer)




    Dim refItem As Reference


    On Error Resume Next


    For Each refItem In References
    If refItem.IsBroken Then
    MsgBox "reference " & refItem & " is broken, which is normal."
    References.Remove refItem
    End If




    Next refItem



    End Sub

  9. #9
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Do you think I should deactivate it then perhaps activate it when an "admin" user logs in?

  10. #10
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I removed the reference then added the references when the admin enter's their area using:

    Code:
    Dim strPath As StringDim strR As Reference
            'name of path of office outlook library needed to do emails
            strPath = "C:\Program Files (x86)\Microsoft Office\Office14\MSOUTL.OLB"
    
    
    For Each strR In Access.References
        If strR.FullPath = strPath Then
        MsgBox strPath
        Access.References.Remove strR
        End If
    Next strR
    
    
                   'checks if it is there to use
                   If FileExists(strPath) Then
            
                   'add the reference
                   References.AddFromFile (strPath)
                   
                   'do rest of tasks
                   DoCmd.Minimize
                   DoCmd.OpenForm "frmOffice", acNormal
                    
                   Else
            MsgBox "You can't use admin because you don't have the nessesary outlook library, the application will now close - please talk to admin."
            Access.Quit
    End If

  11. #11
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    This really is a temp fix until I figure out how to remove the reference on application load.

    I still have to remove the reference on close for it to work effectively until I get a proper fix.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    An alternative to Outlook is using CDO for email. Doesn't require Outlook library reference.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    An alternative to Outlook is using CDO for email. Doesn't require Outlook library reference.
    yes but it won't integrate with Outlook which is what the users want.

    For generic tasks like no-reply emails I will use CDO

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 12-12-2013, 07:22 PM
  2. search for folder and return full path
    By eladz949 in forum Programming
    Replies: 3
    Last Post: 12-23-2012, 02:26 PM
  3. Replies: 3
    Last Post: 07-30-2012, 02:16 PM
  4. Replies: 10
    Last Post: 03-04-2012, 12:17 AM
  5. parametrize file path
    By ysrini in forum Access
    Replies: 3
    Last Post: 03-01-2010, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums