Modules & VBA :: Deleting File From Network

Dec 2, 2014

I have a button that adds pictures/files to a network location. So people from all over the company can do this and all pictures/files are stored in one location.

I also have a delete button, but a waning pops up and the file remains on the network.

PHP Code:

Run-time error '424': object required 

Code:
My.Computer.FileSystem.DeleteFile (Path)

where Path is a string, files location on network.

View Replies


ADVERTISEMENT

Modules & VBA :: Verify A Network Connection / Bad File Name Or Number

Mar 22, 2014

I have a picture stored on a network file share that populates each time a particular form is opened. Every so often we lose our connection (which is a different issue altogether). Right now the error I get after much grinding away, is "Bad file name or number"

Is there a quicker way to check for the connection before it spends 45 seconds trying to find the whole path?

Code:
Dim vFolderPath As String, dirFile As String, strFile As String
vFolderPath = Nz(DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'"))
dirFile = vFolderPath & Dir(vFolderPath & ctrl_people_id & " *", vbDirectory)
strFile = dirFile & "profile_pic.*"
'Debug.Print dirFile
On Error Resume Next
If Dir(strFile) <> vbNullString Then
Me.[ctrl_ImageFrame].Picture = dirFile & "" & Dir(strFile)
Else
Me!ctrl_ImageFrame.Picture = "X:~stuffprofile_icon.png"
End If

View 4 Replies View Related

Modules & VBA :: Deleting File Based On Date

Feb 12, 2014

So I currently have a module which automatically backs up my database to a separate file everyday on open of my database.

If is it possible to create a function which will allow me to delete these backups after a certain amount of days (eg 30 days). They all have different file names based on the time that the backup was created but have the same extension of "*.accdb". I ask because it stores EVERY backup so the storage space required will soon build up unless manually deleting the files which is not what my client will want,

I have tried using the "Kill(pathname)" function but have had no luck yet!

If possible, I would like this to be done automatically either on open or on close of my database.

Would this be done with a module?

View 1 Replies View Related

Modules & VBA :: MDB File - Deleting Multiple Items In List At Once

May 28, 2014

In appendix is .mdb file with this thema.

Inside you can find one form with listbox (with multi selecting ability).

I use this code :

Dim strSQL As String
Dim i As Variant
With Me.se1
For Each i In .ItemsSelected
SQL = "DELETE '*' FROM [t1] WHERE [id] = " & .ItemData(i) & " ;"
CurrentDb.Execute (SQL)
Next
End With
Me.se1.Requery

Result is this one :
1) If I delete only one item in list, it is ok. I can do it again and again and it is working fine.

BUT

2) If I delete more items in list at once, it is ok - but if I will try to do it again then there is an error because .ItemData(i) value is Null.

View 10 Replies View Related

Modules & VBA :: Deleting Record And Then Delete Listed File?

Jan 7, 2015

What is the correct syntax that would delete a file when the record is deleted. The file's path is listed in a record field, MailLocation. Every time I try this code, I receive an error!

I've tried the below, and number of iterations, including calling the killfile differently (me![MailLocation], me.MailLocation).

Code:
Private Sub Form_AfterDelConfirm(Status As Integer)
Dim KillFile As String
KillFile = me!MailLocation
Kill KillFile
End Sub

View 6 Replies View Related

How To Update Network Link To The Correct File.

Dec 6, 2006

I have 2 files with linking tables. Both are posted on the same network drive for the office to access. However some users have their drive link to drive E: and some to G:, etc. How do I get the file to automatically find what drive the user has and update the correct link in Linked Table Manager?

Thanks for your helps,

Penguin

View 4 Replies View Related

Access Network File Sharing Problem

Apr 30, 2007

I am running a small access database over a wireless network which all worked fine (still does on 1 wired/3 wireless) with not too many problems total of 6 machines (5 wireless/1 wired). I have just replaced two machine as they were getting a bit old 3years. But these two new machines do not seem to have full rights to the access database, in that I can open the database and view records but when you add data you get a Disk Error message. I can open and share word documents etc but not the database – if I reverse this set-up I get the same problem the wired computer can open and save word documents but again not the database - what am I missing!!!

SET-UP = All machines have Windows XP Pro and Office 2003 with all windows/office updates done, all connected to the same workgroup etc. Two new machines are Dell with Dell Wireless adapter. No server just workgroup and database in a shared folder on one computer which is hard wired to the Netgear wireless router. I have not run any network wizards and I don’t think I need to, just sharing the folder should be enough? Windows is managing the dell wireless adapters, file and print sharing is enabled, other computers can print to this computer, but I just can’t get the database to share correctly – I have also checked “References” and all looks fine.

View 5 Replies View Related

Sharing Of Single Access File On The Network

Jan 22, 2008

I have created the time booking application in access. (Application will alow autherised user to enter daily work done) My Idea was to put this file on the server and ask each employee to log in and enter information. But whenever I try to run application from other than my pc(On which file is created) it flashes error and can't run some of the form. It works absolutely fine when run from my pc. Why this hapens? What is the solution for this? Can access application is sharebale over network?

View 10 Replies View Related

Deleting .ldb File

Nov 8, 2005

I have a database that needs repaired, but can't because the database thinks users are still in it. The users listed in the .ldb are not logged in. Can I simply delete the ldb file, or the contents of the ldb file, then repair, w/o consequences?

thank you!!!

View 3 Replies View Related

Error Accessing File. Network Connection May Have Been Lost

May 20, 2005

I think the damage to my database is not recoverable, but i'm still hoping.
My computer crashed when I was working on my dtabase and after restart the db is not working anymore :( If I try to do something, anything (!!!) all I got is an error message: "Error accessing file. Network connection may have been lost." But the db is on my computer, I don't use it over the network.
What can I do to make it working again?
Thanx!

Attila

View 8 Replies View Related

Time Out Issue While Sharing Access File On Network

Feb 11, 2008

I have created multi user access application. I have kept it on server and all users access that application from there desktop pc. Can I set time out for application? Means, Session of each user must be note more than 10 minutes. I want to add this functionality for avoiding the application blocking.

View 2 Replies View Related

Deleting Oldest File

Apr 9, 2006

Problem

code:

Option Compare Database
Option Explicit
Function Backup()
Dim fso As FileSystemObject
Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackUpPath As String
Dim sBackUpFile As String
Dim strSQL As String

sSourcePath = Application.CurrentProject.Path
sSourceFile = Application.CurrentProject.Name
sBackUpPath = Application.CurrentProject.Path & "Odontiatreio BackUp"
sBackUpFile = sSourceFile & Format(Date, "ddmmyyyy") & " " & Format(Time, "hhnnss") & ".mdb"
'Add new file to table.
'Assumes tblFile has 2 fields:
' FileID (AutoNumber)
' FileName (text)
strSQL = "INSERT INTO BackUp(BackUpFileName) " _
& "Values('" & sBackUpFile & "')"
CurrentDb.Execute strSQL
'Delete oldest filename if there are more than 5 records.
strSQL "DELETE * FROM BackUp " _ ============>Error<=========
& "WHERE BackUpID IN(" _
& "SELECT MIN(BackUpID) FROM BackUp " _
& "HAVING COUNT(*)>5"
CurrentDb.Execute strSQL, dbFailOnError
Set fso = New FileSystemObject
fso.CopyFile sSourcePath & sSourceFile, sBackUpPath & sBackUpFile, True
Set fso = Nothing
End Function


Error:
Compile error:
Expected Sub, Function, or Property

What is wrong???
__________________
Alexandros

View 5 Replies View Related

Deleting Oldest File

Sep 23, 2005

Greetings!

I am using this in a module to copy files to a directory:

----------------------------
Public Function Backup()

Dim fso As FileSystemObject

Dim sSourcePath As String
Dim sSourceFile As String
Dim sBackupPath As String
Dim sBackupFile As String

sSourcePath = "c:a"
sSourceFile = "db2.mdb"
sBackupPath = "c:aa"
sBackupFile = "BackupDB_" & Format(Date, "mmddyyyy") & "_" & Format(Time, "hhmmss") & ".mdb"

Set fso = New FileSystemObject
fso.CopyFile sSourcePath & sSourceFile, sBackupPath & sBackupFile, True
Set fso = Nothing

End Function

---------------------

Now, what I want to do is delete the oldest file after there have been 5 files copied. In other words, I will be running this once a day and only want to retain the newest 5 copies. Once the sixth has been copied, delete the oldest one in the directory.

Any suggestions?

View 3 Replies View Related

Is There Any Method To Synchronize Two Access File Which In Desktop And Network Drive

Aug 14, 2007

Here are some background . My company got a access file in a network drive.The data entry simply open the file in the network drive.But once the data has increased (~400mb) sudddendly,all process slow down. Like search , using report etc.Is there any method to imporive the situation?Some guys suggest me to copy the data file to the desktop and sync them.Can it it work?IF works,how to do that?

thanks gratefully for any ans

View 3 Replies View Related

Error After Deleting Split Database File

Nov 16, 2011

We have a MS Access Application. It involves authentication as well. I split the database and created this db_be file. I deleted this. Now I'm not able to login into this Application.

View 1 Replies View Related

General :: Does LDB File Have To Be Closed For Another User On Network To Read / Write Info To Table

Feb 11, 2013

Does a (the) .ldb file have to be closed for another user on a network (separate FE linked to network drive BE) to read/write info to a table? Or even select info from a table?

View 6 Replies View Related

Please Help!! "Error Accessing File. Network Connection May Have Been Lost"

Oct 12, 2007

Hi all,

I have been developing Access 2K applications. Lately, every time I click a command button on a form or even open the code window for a form, I got this repetitive error message. I even create BLANK Access db and re-import all objects or create brand new form and copy the control designs/code from the error one to the new one. The new db or the new form still have the same ERROR, which is as follow :

"The expression On Click you entered as the event property setting produced the following error: Error accessing file. Network connection may have been lost.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro."

Please help! Thanks so much for your suggestions/
Have a great weekend,

View 1 Replies View Related

Modules & VBA :: Storing Attachments On A Network

Jun 12, 2013

First, I'm developing both the Front End and Back End in Access 2007, and I intend to distribute the application using the Access Run Time. The powers that be will not let me use SQL Server.

The database is required to house attachments. Initially, I had created a separate back end database to store the attachments, but the file would quickly grow beyond the 2GB limit - roughly within 3 weeks. Instead, I decided to save the "attachments" in folders (named after the parent records PK ID) on the network. Using VBA, I would populate a list, based on the parent record, from which the user could select the file, do what needs to be done, then save it.

Unforunately, we're running into data security issues - all of the attachments will have private personal information - SSNs, Loan Numbers, Account Numbers etc., so they need to be stored in a location that's not universally accessible. All of the users have different permissions based on their department, acting as a very basic security level (i.e., Department 1 users will not be able to view any parent records associted with departments 2 or 3).

So I need a way for my back end to take a file located in a separate directory not normally available to the Front End User, then move that file (or save a copy that will be overwritten when re-attached to the record) to a location that IS accessible to my Front End User.

Can I create/use modules stored on the back end?

My first thought is to let the back end store the record in a temporary attachment table that is deleted when the user is done with it, but I've noticed that Access has trouble reclaiming the space when the attachment is ultimately deleted once the user is done using it, and I'll run into my 2GB limit again.

Alternatively, I could create a new .accdb file each time the record's attachments need to be accessed, and then delete that database once it's done and the attachments are returned to the secure location, solving my limit problems.

View 1 Replies View Related

Modules & VBA :: Simulate Link To Network Path

Sep 10, 2013

I have a front end and a back end access files.My user save the back end on a shared network folder like:a.b.comfolderName$..I wish to simulate this path in my local pc in order to set the linked table links.My problem is that I can not modify my pc name to be "a.b.com".How can I simulate this in my windows 7 pc ..so I can set the linked table values to "a.b.comfolderName$" ?

View 8 Replies View Related

Modules & VBA :: Users With Different Mapped Network Drives

May 13, 2015

I need to make sure that all users on the network can access a specific network drive folder.

Most users don't have a problem but some users have the network drive mapped differently so when running the feature required their system can't find the file at that specified location.

I have the location of the files hard wired into the VBA code.

E.g. Z:INVDATACOMPANIESCompanyAASSETS Pty LtdPrecedents 2015STAGE 3A - COLLS-DEMS

The location is outside of the project address.

I need to be able to make sure the address of the folder is the same for all users.

View 3 Replies View Related

Modules & VBA :: Deleting Only One Record?

Apr 3, 2014

How do I delete only one record in a table that has duplicate records using SQL?

Code:
DELETE tblTemp.Fruit, tblTemp.[Country of Origin], tblTemp.Qty, tblTemp.Date, tblTemp.Currency
FROM tblTemp
WHERE (((tblTemp.Fruit)='Fruit') AND ((tblTemp.[Country of Origin])='Country of Origin') AND ((tblTemp.Qty)='Qty') AND ((tblTemp.Date)='Date') AND ((tblTemp.Currency)='Currency'));

View 10 Replies View Related

Modules & VBA :: Send / Receive Small Text Strings Over A Network

Jul 20, 2015

Small piece of code that can send / recieve small text-strings over a network. I finally got it to work, but forgot to think ahead . Right now it only works in a formular but i really need to be a function with input / output.

My problem is that i am using the "Withevents" to call the Ostrosoft Winsock network module and "Withevents" does not work in functions.

How to build this into a function ?

Code:
Option Compare Database
Option Explicit
Dim sBuffer As String
Dim spage As String
Dim WithEvents wsTCP As OSWINSCK.Winsock

[Code] ....

View 2 Replies View Related

Modules & VBA :: Application Quit Doesn't Work On Network Users

May 26, 2014

My database is used by a few users on a shared drive in "read-only" mode so they can't change any data.I set a scheduled task to copy an updated version of the database (which I edit) every morning.

The problem is that when the users forget to close the database file I can't overwrite it.For this purpose I wrote a small code that quits the application at 00:00 using Application.Quit.The code WORKS when I test it on my computer, but every morning when I try to open the file I see that it is opened by another user since I also open it as "read-only" - meaning the code didn't work...getting the code to work properly OR get a better solution to be able to overwrite the file even though it's opened by other users.

View 10 Replies View Related

Modules & VBA :: Code For Querying A List Of Filenames Within Network Directory?

Dec 12, 2013

After several days of searching, I haven't been able to find any threads related to this. I'm making a search form that queries a pdf library table. Once a search query is entered, the user is able to open the files from a results form. Currently, I am entering the filenames from the network directory manually into the pdf library table.

For example, I manually enter the following information into the tblPDFLibrary table that contains the fields:

Date added, Filename, File Path, Series, Class, Title.

I was wondering if there's a way to have Access query all the filenames in the directory for me. In other words, if the directory contains the filenames: AccountsPDF, InventoryPDF, CustomerPDF. Can I have Access query all the filenames within the directory and automatically add all the file names (AccountsPDF, InventoryPDF, CustomerPDF) to the Filename field within the tblPDFLibrary table? If I am able to do this, I can code the other fields to populate information because the filename contains all the other field information (except for file path but I can program it insert the UNC path).

View 4 Replies View Related

Modules & VBA :: Deleting Records Within Certain Timeframe?

Jun 19, 2014

I would like to make it so that if that last record inputted with the same ID was inputted within the past 5 minutes then it will not input the new record into the database. Im not sure how to code that time frame, but more importantly how to tell access to not do anything if the criteria does not match.

here is my code:

Code:
Dim LrecID As Variant
Dim LrecInOUT As Variant
Dim LrecDate As Variant
Dim Lname As String
LrecID = DLast("EmployeeID", "QryEmployeeClockIn", "EmployeeID=" & Me.EmployeeID)

[Code] ...

' I was thinking something like this:

' If Me.EmployeeID = LrecID And LrecInOUT = 0 and LrecDate is not within 5 minutes ago Then
' InOut.Value = -1
TimeStamp = Now()
DoCmd.GoToRecord acForm, "FrmEmployeeClockIn",

[Code] ....

View 3 Replies View Related

Modules & VBA :: Deleting Values In Array?

Jul 1, 2013

How do I delete values in an array? I want to reuse that array but first I need to delete its values so I would start with Arr(0) rather than where I stopped off with the last loop at Arr(10) [assuming the last calculation inserted until Arr(9)]

Here is my code:

Set rst = CurrentDb.OpenRecordset( _
"Select * from dbo_ProductStructure where ChildProductNbr Like '*" & txtPartNumber & "*'") 'search associated fields with user input
While rst.EOF = False
ReDim Preserve Arr(i)
Arr(i) = rst.Fields("ParentProductNbr")
i = i + 1
rst.MoveNext

Wend 'end of while loop

x = Arr

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved