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??
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??
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.
yeah I am using
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...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
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.
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?)
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.
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-)
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
Do you think I should deactivate it then perhaps activate it when an "admin" user logs in?
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
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.
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.