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 Replies
ADVERTISEMENT
Jun 17, 2013
How do I direct the ZipFilePath and ZipFolderPath to use a directory I define in a textbox in a form? Instead of hard code like it is now?
Option Compare Database
Option Explicit
Public Sub NewZip(ZipFilePath)
On Error GoTo Err_NewZip
Dim lngFile As Long
lngFile = FreeFile
[Code] ......
View 2 Replies
View Related
Oct 10, 2013
I would like to get a list of all the users in the active directory and put them in a combo box. How to do this? I would like it to show there CN name
View 9 Replies
View Related
Jun 11, 2013
it has a listbox, wich RowSource is a query with 5 fields, BoundColumn is field#1.I have a comboBox with values of field#1 to have an 'AfterUpdate' Event, that highlights the row in the listBox that has the value of the comboBox in in field#1.
View 1 Replies
View Related
Dec 11, 2006
I'm having a small difficulty in using the code example ghudson posted for Browse [Find a directory or file]. First off, the code works great. Thanks a lot for posting it!
The problem I am having is when linking a folder via dBrowseDirectory. The folders I am linking are on a shared network drive and I am trying to figure out how to set the initial directory to default to the networked PC. This way the user doesn't have to navigate to the shared drive every time. All they would have to do is navigate to the particular folder to link (2 clicks instead of 10+).
The dBrowseFiles function allows to set an initial directory, however I cannot figure out how to set it for dBrowseDirectory. Is there any way to do this by altering your code for dBrowseDirectory?
Thanks in advance!
View 5 Replies
View Related
Sep 13, 2006
I have a form from one of the gurus on site and I have tried to tweak the code to show a directory per record (Access2000) Its half working I open up the form and get "13- type mismatch"
vDir seems to be empty (I have pt a file in their to veiw)
running the cursor over QteNo & qteinsnme - both have what I expect in them (A number and a name respectively)
howver Vir seems to be empty and when i debug it oes straight to "Resume Exit_FilesAndDetails) second from bottom line of code copy code below
Private Function FilesAndDetails()
On Error GoTo Err_FilesAndDetails
Dim rs As Recordset
Dim vDir As Variant
Dim sPath As Variant
sPath = "C:Coverex international" & "Forms!main!QteNo" & " " & "Forms!main!QteInsnme" & " "
'Const sPath = "C:Coverex international(Me!QteNo)(Me!QteInsnme) """
' Const sPath = "C: emp" 'sPath must end with a back slash, sPath = "C:Windows"
CurrentDb.Execute "Delete tTempFiles.* from tFiles;"
Set rs = CurrentDb.OpenRecordset("tFiles")
vDir = Dir(sPath & "*.*")
Do Until vDir = ""
rs.AddNew
rs!FilePathName = sPath & vDir
rs!FilePath = sPath
rs!FileName = vDir
rs!ModifiedDate = FileDateTime(sPath & vDir)
rs!FileSize = FileLen(sPath & vDir)
rs.Update
vDir = Dir
Loop
rs.Close
Set rs = Nothing
DoCmd.Requery
Exit_FilesAndDetails:
Exit Function
Err_FilesAndDetails:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_FilesAndDetails ******yellow highlight here
End Function
View 1 Replies
View Related
Apr 18, 2007
Is there a way to make a directory box, like you can find invisual basic, that you can dynamically search folders for files?
Thanks
View 1 Replies
View Related
Feb 25, 2015
i am new to access. how to create a list of files in a directory outside of the access program C:UsersalDesktopMSACCESS PROGRAM is the location
View 2 Replies
View Related
Apr 19, 2007
I have a db for a list of people who have attended courses.
Each year they have to attend a refresher.
I can easily query those people who are in date.
How do i query to find people who attended a course but not a refresher?
Thanks
View 4 Replies
View Related
Mar 23, 2005
I have 12 folders (User1 - User12) located in "c:users..."
When I select a UserName from a combo box in a form e.g. User3 , a list of all files with extensions ".doc" in the respective directory (c:usersuser3*.doc) should render with a hyperlink to the file / s.
I have tried variouse "Select Case" and "FileSearch, FoundFiles" scripts, to no avail.
Any assitance would appreciated.
Current Version: Access 2000
View 2 Replies
View Related
May 29, 2013
I've been tasked with coming up with a table structure that will allow me to make a form that lists the available static ip's in my various network range blocks (we have multiple off-site locations and use different ip ranges at each site).
I have the vision in my head of the form, you would select the block range from a drop down list, then see all the available addresses in that range. From there you could assign mark one as used and it is no longer listed on the form (I'm thinking a simple yes/no checkbox). What my co-workers would love to see is if there were entering a new PC assignment and put one of those available IP addresses into that forms record (different table too) then the ip would get deleted from the available pool as well.
View 2 Replies
View Related
Nov 5, 2014
come up with the below code to create PDF documents based on a query. It has been working great but I have a change that I need to make and can't figure it out. The code below creates all the documents in one folder "serverD$DocumentsInvoices" but I need it to create a separate folder for each PDF so that the file (Invoice1234.pdf) will be in the folder (serverD$DocumentsInvoicesInvoice1234Invoic e1234.pdf). That folder does not exist, so I need to create it and then save the PDF into it.
Code:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As QueryDef
Set db = CurrentDb
Set qdf = db.QueryDefs("Invoice_Report")
Set rst = qdf.OpenRecordset
[code]...
View 3 Replies
View Related
Nov 28, 2013
How to send an email using access but how to get the emails address that are in the active directory...
View 14 Replies
View Related
May 8, 2014
I want to link into the active directory to get a list of staff usernames, so it will update the user table as new members of staff are created etc. We currently have around 130 staff, so rather than manually updating the user table i want it to pick up the usernames from AD?
View 3 Replies
View Related
Jul 25, 2013
I'm trying to check a directory for a folder name which has a certain string in it (RecNum)
However the fso object filesys.FolderExists does not take an argument when looking for part of a folder name on a particular path.
What I basically want to do is look in a directory for a folder with the RecNum variable as part of the folder name. if it exists open it, if not create it.
This is how far i've got:-
targetdir = targetpath & RecNum & ChannelPartner & Enduser
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists(targetdir) Then GoTo function_end
MkDir targetdir
If filesys.FolderExists(copypath) Then
filesys.CopyFolder copypath, targetdir
End If
MsgBox ("folder created")
function_end:
Shell "Explorer.exe /n,/e," & targetdir, vbNormalFocus
View 6 Replies
View Related
Aug 28, 2013
I have some code that resides in a button on a report that allows me to save a PDF version of this report. My problem is that if i have the destination directory open on windows explorer, i get a runtime 2501 "The output To action was cancelled" error.Is there any way to check if the directory is already open, and cancel the output to, or close the window to avoid this error?
Here is my code:
Code:
Private Sub CmdSavePDF_Click()
Dim MyFileName As String
Dim MyPath As String
'Dim CompanyName As String
[code]...
View 1 Replies
View Related
Sep 6, 2013
I am using a API to generate a random / unique directory. This an API form a 32-bits environment.
I know that you can still use it when declaring it with PtrSafe
This is the code I am using:
Option Compare Database
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
[Code] .....
View 1 Replies
View Related
Jan 5, 2013
How to view the file names of attached files in Access 2010 using a Web Database, specifically the Contacts Web Database that is a template in Access.
Currently it only shows one PDF icon for all my PDF files. I would like to be able to view the file names of all the PDFs in the attachment field. While I'm certain this can't be done within the same field as the attachment box (though would be nice), I would think it would be possible to populate another field with this information.
I have experimented with different things with no luck using a new standard database for testing purposes. The closest I've come was using the SubForm/SubReport; it actually gave me the values for the attachment... see in the picture below.
But even then, it did not work and gave a error: Invalid Control Property: Control Source
View 9 Replies
View Related
Jul 20, 2015
I have a database that, I would like to add a button that performs a active directory lookup. I would like it to check a username with Active Directory, and auto populate a few fields.
First Name
Last Name
Manager
Department
This is my first database and I have very little exp using VBA.
View 7 Replies
View Related
Feb 15, 2015
When creating an incoming inspection database, I want to set it up so when I am in a form to add data, I want to have a command button where I can pull up the associated CAD drawing based on part number and drawing number. I would like to enter the directory location into a table so I could change it if I need to.
So basically I want to go something like this:
.tblDirctoryLocation
txtDirectory
.tblProduct
txtProductName
txtProductNumber
txtProductCADNo
These tables would not be related to one another as there will only be one record for the directory location and multiple records for products.
Somehow I want the db to assemble file location like this:
“EQuality_DirectoryIncoming” & “ProductNumber_” & “CADDrawing” & “.pdf”
End result: EQuality_DirectoryIncomingProductNumber_CADDraw ing.pdf
Is there any way this could be done?
View 1 Replies
View Related
Sep 1, 2014
I'm using a function to find all files/folders in a specific directory, then copy each one to a specific destination folder. I'm going to use this on a weekly basis to backup files on a computer. I would like to use the vbarchive in GetAttr/SetAttr so I only need to copy these if they have changed since last backup.
Something like:
If GetAttr(strFile) And vbArchive = 32 then
filecopy xxxx, xxxx
else
rs.movenext
As I understand it, a value of 32 indicates that the file has been modified since it was last backuped up (i.e. since the file attribute was "reset"). How do I "reset" the file attributes to clear the vbArchive?? I've read some google searches and the only thing I could find was the files were set to vbnormal however I'm concerned that this will erase program files that are vbReadOnly or VbHidden.
View 5 Replies
View Related
May 4, 2014
I am using Access to save an Excel file in a particular directory. The code was created about 10 years ago and hence saves the file with .xls extension and I would like to save with a .xlsm extension. If I just change the .xls to .xlsm, in the code below, the file is saved but the Compatibility Checker comes up (I would like to stop this) and when the file is reopened I get an error message stating there is a file extension problem and the file won't open.
Code:
strExt = ".xls"
'If .txtFriendlyName <> "" Then
' strDestFileName = .txtFriendlyName
'Else
' strDestFileName = Left(objFile.Name, Len(objFile.Name) - 4) & MakeFilePosfix(Now())
[Code] ....
View 7 Replies
View Related
Dec 22, 2014
Is it possible in access, to create a button that will copy a file to a new directory? Specifically, the data field in question is an access hyperlink that we can click on to open a PDF drawing of a part. I just want to copy the file the hyperlink points to, into a new directory.
EX:
X:database/drawings/somefile.pdf
X:erp/drawings/somefile.pdf
I don't think a macro can do this, but perhaps vbscript can.
View 2 Replies
View Related
Jul 21, 2015
I have contract notes files in .xls format towards sale of equity shares from the brokerages. I have to do some editing in these files like deleting some rows, adjusting width of columns and inserting date of contract.
a) Contract-A.xls shows original file.
b) Contract-B.xls shows modified file
c) VBA macro code used for deleting rows and modifying column width is shown in modify_contractnotes.xlsm file.
d) Presently I open the file and copy and paste the contents on the macro-enabled workbook sheet . After macro operation I transfer back the contents by copy and paste to a master file(Contract-C.xlsx) and clear the contents in the macro enabled workbook to make it ready for another operation.
e) It is time consuming process for around 60 files per month.
f)After this operation I run RDBMerge add-in to consolidate and normalize all these files in a directory. RDBMerge smoothened out merged cells also.
Is it possible to have a macro-enabled workbook open all the time and the contract files be opened one after other and macro contained in macro enabled workbook by modifying its code suitably operate on these contract files.
Files are attached in modify_contractnotes zipped folder.
View 4 Replies
View Related
Dec 20, 2013
I am looking to create a backup of a database on exit in a different directory then where I am storing the database now.
View 3 Replies
View Related
Jan 12, 2005
This is complex, but here goes.
I am copying many many music cds to my hard drive. However, the song file names on the cds are track01.mp3, track02.mp3, etc. I have all the real songnames for each cd listed in the database. I need a way to rename the songs with their real names one cd at a time. My thought was to populate one table with the directory and filenames (track--) of the songs and populate another table with real songnames from the database. Then, somehow, rename the files. I'm lost. I hope someone can help!
View 1 Replies
View Related