Create an Office Folder and Link to the folder

dgaller

Registered User.
Local time
Today, 18:01
Joined
Oct 31, 2007
Messages
60
Ok, first I am self taught and still learning how to write code. I have spent 2 days searching forums and trying to modify code for and answer but I need help before I pull my hair out.

I have a db I created that currently imports attachments and I have since learned of the 2 gig rule and am working on an alternative.

What I would like to do is have a command button on a form that will create a windows folder using the forms Task ID (primary key) as the name. Then save that as a link to open the folder thereafter from the form.

Is there a simple way to do this?
 
yes

first you need make dir
mkdir (check samples for this)
then you need to have a window to open up this folder (I have this at home - but not at work) -

will post this up in a couple of hours
 
That would be great thanks!
 
I'm sure this would be all you need as an example sir...

look at what's done closely. it doesn't seem like what it looks like. read the code to see how you can adapt it. =)
 

Attachments

this is nice - but there are slightly better options out there

this creates a folder
in
C:\Sample1\
then policyno is a number 123456
so
C:\Sample1\123456 is the folder

now you need to have a button to opent he folder from witihn access and list all docs in it -- I am trying to find this (none of my own work )
Button code

Private Sub Ctl_cmbMkDir_Click()
On Error GoTo Err_cmbMkDir_Click

Dim DirName As String
Dim Response As String

DirName = "C:\Sample1\" & Left(Me!PolicyNo, 6)


If Dir(DirName, vbDirectory) = "" Then
If MsgBox("OK to create folder!", vbOKCancel) = vbOK Then
MkDir DirName
Else
MsgBox "Create folder cancelled. Folder not created."
Exit Sub
End If
Else
MsgBox "The folder already exists..." & Chr(10) & "Please check the directories using Windows Explorer.", vbOKOnly
Exit Sub
End If

Response = MsgBox(DirName, vbOKOnly)



Exit_cmbMkDir_Click:
Exit Sub

Err_cmbMkDir_Click:
MsgBox Err.Description
Resume Exit_cmbMkDir_Click



End Sub
 
you need the zip file findfiles by Dcrake (?)



-

get the make dir sorted first -

then mess about with this (import the forms etc)

ensure that you have a clean copy of your project on a memory stick in case it goes tits up -
 

Attachments

this is what i use and you don't need to store the file location as the files is always going to be ont he record you are looking at - then there is a retrive button that retrievs all the files in that directory - and you double click them to open - any file will work as long as the base pc can read it -

this saved me a lot of headache --so big thanks to the guys who did the coding --
 
How do I save the path to be used later?
mine was just an example as to how to use the technique to get what you want DGaller. If you would like someone, Gary or I took take a look at what you have now, upload the database, and I'm sure he or I can incorporte either what "he or I" have done for you here. Let us know if you want to do this...
 
I think the DB is to large to attach.

I currently have the MKDir working great using a combination of both ideas. Thank you both!

I am still struggling with linking to the folder later. I adapted the find files as suggested but it has limitation like it doesn't show zip files and I can't open emails saved as a .msg file. They show but don't open.

Any other suggestions on how to just set a hyper link to the Dir I created?
 
Any other suggestions on how to just set a hyper link to the Dir I created?
i showed you that with the hidden textbox under the label.

you do not SET a hyperlink to a directory. You follow a directory's PATH using the:
Code:
application.followhyperlink
method is VB.

HTH
 
Something else to play with:D

If Len(Dir("c:\" & ([Forms]![PForm]![NameNumber]), vbDirectory)) = 0 Then

MkDir "c:\" & ([Forms]![PForm]![NameNumber])

End If

That creates a folder on C: and the name of the folder is whatever is in NameNumber field on the form PForm

Call Shell("explorer.exe c:\" & ([Forms]![PForm]![NameNumber]), vbNormalFocus)

That opens the folder.

If you were going to make a lot of these then it is better to do them as a sub folder otherwise you C drive will look like a phone book:D

 
hense the
DirName = "C:\Sample1\" & Left(Me!PolicyNo, 6)

this would visual make your c drive tidier
"
I am still struggling with linking to the folder later. I adapted the find files as suggested but it has limitation like it doesn't show zip files and I can't open emails saved as a .msg file. They show but don't open"


now that i didn't know - however i wasn't gonna zip files up - i was going down a word,pdf ,xls ,txt route -- try Mikes route - I just hack things together - mike sounds like he a bit more in tune with your needs

(Note to AJ - just read my post - it might of come accross a bit rude -wasn't meant to be - aplogises in advance if it has -) regards

g
 
lets give the OP what he needs now. this thread is already too long. (np Gary. ) :)
 
Thank you all ! Even with my limited VB knowledge I have been able to compile all the advice and acheive my goal. Thank you!
 

Users who are viewing this thread

Back
Top Bottom