473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Copying CD directory contents to text or memo field

Hi there,

I've tried to search on this topic but had little luck. Essentially, i am constructing a simple CD library database and would like to be able to capture the contents of the CD (either folder names or file names) to a memo field within the database.

I can do this manually using the freeware app JR Directory Printer but would like to be able to build this functionality into the database activated by a button click.

I am running Access 2002

Any suggestions much appreciated.

Kind regards

DFG
Feb 6 '08 #1
3 1697
Rabbit
12,516 Expert Mod 8TB
You'll want to look at the FileSystem object. It lets you return information about files.
Feb 6 '08 #2
FishVal
2,653 Expert 2GB
Hello, DFG.

You'll need to write a simple recursive function with the following logic (in pseudocode).
Expand|Select|Wrap|Line Numbers
  1. Function ScanFolder (fldFolder)
  2.     add fldFolder name to the memo
  3.     For Each fldMySubFolder in fldFolder.SubFolders
  4.         ScanFolder fldMySubFolder  'call itself
  5.     Next
  6.     For Each filFile in fldFolder.Files
  7.         add filFile name to the memo
  8.     Next
  9. End Function
  10.  
And invoke the function passing reference to root folder. It then will scan the whole filesystem tree.

All necessary classes to implement this in a real code you may find in "Microsoft Scripting Runtime" library. See the tip of the week - TheScripts Tip of the Week #43 - Microsoft Scripting Runtime #1.
Particulary you'll need the following classes.
  • Scripting.Drive (RootFolder property)
  • Scripting.Folder (Files, SubFolders properties)
  • Scripting.File (various properties)

Feel free to ask additional questions if you'll encounter difficulties in coding.

Regards,
Fish
Feb 6 '08 #3
Hi Fish, thanks for your pointers, it should head me in the right direction though being a bit new to all this i may be back for more help later. Cheers. DFG

Hello, DFG.

You'll need to write a simple recursive function with the following logic (in pseudocode).
Expand|Select|Wrap|Line Numbers
  1. Function ScanFolder (fldFolder)
  2.     add fldFolder name to the memo
  3.     For Each fldMySubFolder in fldFolder.SubFolders
  4.         ScanFolder fldMySubFolder  'call itself
  5.     Next
  6.     For Each filFile in fldFolder.Files
  7.         add filFile name to the memo
  8.     Next
  9. End Function
  10.  
And invoke the function passing reference to root folder. It then will scan the whole filesystem tree.

All necessary classes to implement this in a real code you may find in "Microsoft Scripting Runtime" library. See the tip of the week - TheScripts Tip of the Week #43 - Microsoft Scripting Runtime #1.
Particulary you'll need the following classes.
  • Scripting.Drive (RootFolder property)
  • Scripting.Folder (Files, SubFolders properties)
  • Scripting.File (various properties)

Feel free to ask additional questions if you'll encounter difficulties in coding.

Regards,
Fish
Feb 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alfredo Agosti | last post by:
Hi folks, I have an Access 2000 db with a memo field. Into the memo field I put text with bold attributes, URL etc etc What I need to to is converting the rich text contained into the memo...
2
by: Jeremy | last post by:
I have a pretty straightforward database that is designed to record free-form information about products (date, source and a memo field). This is searched and updated via a form. For new records,...
2
by: PMB | last post by:
Thank you in advance for any and all assistance. I'm trying to input data from strings to a memo field. I would like to know how to check first to see if there is text there currently and if so...
0
by: Lauren Wilson | last post by:
The error does not have an error number. It's not even a normal Access error message box. Hope someone has some insight to this problem. I have a form that contains a large (5" x 4") text box...
1
by: Martin Heal | last post by:
I am having problems trying to assign the contents of a Memo table field to a String variable in VB using the following code: Private Function udfBuildSQL(SQLID As Integer) As Variant Dim rs...
0
by: Ennio-Sr | last post by:
Hi all! After a very long struggle I finally succeded in transferring my old *.dbf file and the relating *.dbt (alias memo fields) to a pg table. For the time being I put the memo field in a...
1
by: alexsg | last post by:
A little while ago Ron P kindly responded to my inquiry on how to copy the first line of memo field into a text field, using a query: left(,instr(1,,vbCrLf)-1) This is great, but I would like...
2
by: Teresa L | last post by:
I am using Access 2003. I have a memo field that I have put into a report. My problem is that the report will only show a specific amount of characters in the report. It does not display the...
1
by: barbara_dave | last post by:
Hi all, I want to change a field data type from Text to Memo.The reason is I need to type more text in that field. when I was saving the change I got error message "The width of a Unicode...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.