473,396 Members | 2,024 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,396 software developers and data experts.

Form Macro Button Help Needed to Explore a File Directory

Hello,

I need help creating the code for a macro
button on a form that will open a file
directory with windows explorer.

I have about 500 directories with very
long names and only want to input part
of the directory name into the table
that the form uses.

directory name examples:
c:\data\MK-0001_machine_tool_programs\
c:\data\MK-0002_machine_tool_fixtures\
c:\data\MK-0500_machine_tool_maintenance\

The first part of the dirctory name is always the same:
c:\data\

I just want to enter the next seven characters in my table
into a filed called "directory". Example:
Mk-0001
MK-0002
MK-0500

The rest of the directory name ideally can be represented by a
wildcard "*'. If this isn't possible, I can enter the whole
directory name into the table.

Therefore, when I open my form, select a record, then hit
the macro buttom, it will open windows explorer based on
the value stored in my "directory" field.
Thank you for your help.
Antonio

Jun 18 '06 #1
2 3077
ADezii
8,834 Expert 8TB
Hello,

I need help creating the code for a macro
button on a form that will open a file
directory with windows explorer.

I have about 500 directories with very
long names and only want to input part
of the directory name into the table
that the form uses.

directory name examples:
c:\data\MK-0001_machine_tool_programs\
c:\data\MK-0002_machine_tool_fixtures\
c:\data\MK-0500_machine_tool_maintenance\

The first part of the dirctory name is always the same:
c:\data\

I just want to enter the next seven characters in my table
into a filed called "directory". Example:
Mk-0001
MK-0002
MK-0500

The rest of the directory name ideally can be represented by a
wildcard "*'. If this isn't possible, I can enter the whole
directory name into the table.

Therefore, when I open my form, select a record, then hit
the macro buttom, it will open windows explorer based on
the value stored in my "directory" field.


Thank you for your help.
Antonio
'This should point you in the right direction
'Must 1st set a Reference to the Microsoft Office 11.0 Object Library
'(mso.dll) - Access 2003


Dim varItem As Variant

With Application.FileDialog(msoFileDialogFilePicker)
With .Filters
.Clear
.Add "Text Files", "*.txt"
.Add "Database Files", "*.mdb"
.Add "All Files", "*.*"
End With
'The Show Method returns True if 1 or more files are selected
.AllowMultiSelect = False
.FilterIndex = 3 'All files
.ButtonName = "Open Sesame"
.InitialFileName = "C:\Data\" & Dir("C:\Data\MK-0003*", vbDirectory)
.InitialView = msoFileDialogViewDetails
.Title = "Find the damn File!"
If .Show Then
For Each varItem In .SelectedItems
MsgBox varItem
Next varItem
End If
End With
Jun 19 '06 #2
Answered in microsoft.public.access.formscoding
Jun 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colin | last post by:
In access 2000 I need to filter records in a Subform by pushing a button on a command button located on the Main form. The Main form is blank. Its only purpose is to contain the subform which is...
8
by: Colleyville Alan | last post by:
I have been working on an Access app that takes info from a file and writes it to a spreadsheet on a form, simultaneously saving the spreadsheet to Excel. I got the idea that the same concept...
0
by: dlieu | last post by:
I've found an odd situation in where the Load event of the active form fires (after the Unload event) when Access is closed. I am able to reproduce this situation in Access 2002 SP3 and Access 2003...
4
by: sparks | last post by:
We have a database that reads in and formats raw data. We were using queries to format the data per person and outputing reports. The other database has the persons personal information. I changed...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
14
by: Professor Yonce | last post by:
I have made form for E-Mail. I have entered code but the Import system does not work. It has squiggly line underneath it showing it is not communicating. It Will not build. Public Class...
2
by: deve8ore | last post by:
Hello, I have built a macro to automatically go to a specific directory and a specific folder, however the names of the files I need to automatically locate change names every month. I.e. - I...
3
by: deve8ore | last post by:
Hello, I have built a macro to automatically go to a specific directory and a specific folder, however the names of the files I need to automatically locate change names every month. I.e. - I...
10
by: Marren02 | last post by:
Hi, I recently just unsubscribed my other thread due to the fact that it went against the posting regulations... If you feel offended by what I posted, I apologize I need Code for a save...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.