Microsoft access database samples1/30/2024 ![]() ![]() The extra information can also be useful when troubleshooting problems. The historical data can be very useful when determining users that did not disconnect properly (which can lead to corruption) from the database. There is also the added benefit that this method permit much more detailed information, and historical review (not possible with the UserRoster). I personally find much more useful to create a table to log the database usage by the users and have a form open in hidden mode at the database startup to populate the table in question. Miscellaneous Library (see the heading WhosOn97).How to determine who is logged on to a database by using Microsoft Jet UserRoster in Access.A very common solution to this in the past has been to use the Jet UserRoster, see: The demo illustrated how the above can be adapted to inventory a whole directory of files and log it to a table for easy review.ĭisclaimer/Notes: If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):Īnother common need for most database administrators & developers is to be able to see who is logged into a database. "Error Description: " & Err.Description, _ "Error Source: FSO_GetFileInfo" & vbCrLf & _ "Error Number: " & Err.Number & vbCrLf & _ MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _ If Not oFSO Is Nothing Then Set oFSO = Nothing If Not oFSOFile Is Nothing Then Set oFSOFile = Nothing size 'Remember FileLen() is unreliable!!! DateLastModifiedĭebug.Print "Parent Folder:". 'Invariable Code regardless if Early or Late Binding is usedĭebug.Print "Accessed:". Set oFSO = CreateObject("Scripting.FileSystemObject") ' 'Requires a reference to 'Microsoft Scripting Runtime' library Public Function FSO_GetFileInfo(ByVal sFile As String) ' Added Early Binding sample declarations ' 2 Updated proc Name, variable naming to standardize ' sFile : Fully qualified path & filename with extension of the file to report on ' Req'd Refs: Uses Late Binding, so none required ' Copyright : The following is release as Attribution-ShareAlike 4.0 International ' Could return an Array, Dictionary Object. ' Right now, print result to the VBA immediate window ![]() ' Purpose : Retrieve some basic file information ' Author : Daniel Pineault, CARDA Consultants Inc. To illustrate how you can use FSO, here is a simple VBA example of how you can get some basic file properties '. As I have seen a number of similar questions over the years, I thought I would add it to my blog in the hopes it may help someone else out.Īlthough there are a few build-in functions (such as: FileLen() – do not FileLen() as it is unreliable!, FileDateTime()), because we needed other more advanced properties, at the end of the day, the easiest method to get such information is to use the File System Object ( FSO) to extract the relevant information regarding each file and I demonstrate how this is done. Rather than populate a control on a form, could I create a collection to hold the filenames and attributes that I can then pass to another module to process? If so, any tips on how to create and then reference items in the collection?įinally created a small demo database to illustrate how it could all be pieced together in a seamless manner. ![]() I also need to be able to get and store some of the attributes of each file, specifically the date created, date last changed, and current file size. I need to extract a list of the names of all the files in a specific directory. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |