Creating a folder from job number

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

I have a form to input jobs. When a job is being inputted
would it to create a unique folder for that job named
after the job number field. This would be to put
word,excel and pictures relating to the specific job. Also
could it then produce a short cut or hold the path to the
folder on the individual record for ease of access.

Thanks in advance


Martin
 
Use MkDir in the AfterInsert event procedure of the form where records are
entered.
 
Thanks Allen I have got the basics woking with this

Dim strMyTest As String
strMyTest = Me![JobNumber] & "" & [JobCode]
ChDir ("C:\JobsInfo")
MkDir (strMyTest)

How do I store the location of the folders so that the
users can access then from the individual record of the
database. Basically I want to have a short cut from the
record in the database the the target folder. If that make
sense.

Thanks in advance

Martin
 
Add a field to your table. You could use a Text field, but this example
assumes a hyperlink type field named "MyFolder".

In the BeforeUpdate event of the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strPath as String
If Me.NewRecord And Not Cancel Then
strPath = "C:\JobsInfo\" & Me![JobNumber] & [JobCode]
MkDir strPath
Me.MyFolder = strPath &"#" & strPath & "#"
End If
End Sub

If hyperlink fields are a new concept, see:
Introduction to Hyperlink fields
at:
http://allenbrowne.com/casu-09.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen I have got the basics woking with this

Dim strMyTest As String
strMyTest = Me![JobNumber] & "" & [JobCode]
ChDir ("C:\JobsInfo")
MkDir (strMyTest)

How do I store the location of the folders so that the
users can access then from the individual record of the
database. Basically I want to have a short cut from the
record in the database the the target folder. If that make
sense.

Thanks in advance

Martin

-----Original Message-----
Use MkDir in the AfterInsert event procedure of the form where records are
entered.
 
Thanks Allen seems to work fine....
-----Original Message-----
Add a field to your table. You could use a Text field, but this example
assumes a hyperlink type field named "MyFolder".

In the BeforeUpdate event of the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strPath as String
If Me.NewRecord And Not Cancel Then
strPath = "C:\JobsInfo\" & Me![JobNumber] & [JobCode]
MkDir strPath
Me.MyFolder = strPath &"#" & strPath & "#"
End If
End Sub

If hyperlink fields are a new concept, see:
Introduction to Hyperlink fields
at:
http://allenbrowne.com/casu-09.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen I have got the basics woking with this

Dim strMyTest As String
strMyTest = Me![JobNumber] & "" & [JobCode]
ChDir ("C:\JobsInfo")
MkDir (strMyTest)

How do I store the location of the folders so that the
users can access then from the individual record of the
database. Basically I want to have a short cut from the
record in the database the the target folder. If that make
sense.

Thanks in advance

Martin

-----Original Message-----
Use MkDir in the AfterInsert event procedure of the
form
where records are
entered.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


I have a form to input jobs. When a job is being inputted
would it to create a unique folder for that job named
after the job number field. This would be to put
word,excel and pictures relating to the specific job. Also
could it then produce a short cut or hold the path to the
folder on the individual record for ease of access.

Thanks in advance


Martin


.
 
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
Is it possible to rename the folder after it has been
create, based on a change of the job number field.


Thanks

Martin

-----Original Message-----
Add a field to your table. You could use a Text field, but this example
assumes a hyperlink type field named "MyFolder".

In the BeforeUpdate event of the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strPath as String
If Me.NewRecord And Not Cancel Then
strPath = "C:\JobsInfo\" & Me![JobNumber] & [JobCode]
MkDir strPath
Me.MyFolder = strPath &"#" & strPath & "#"
End If
End Sub

If hyperlink fields are a new concept, see:
Introduction to Hyperlink fields
at:
http://allenbrowne.com/casu-09.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen I have got the basics woking with this

Dim strMyTest As String
strMyTest = Me![JobNumber] & "" & [JobCode]
ChDir ("C:\JobsInfo")
MkDir (strMyTest)

How do I store the location of the folders so that the
users can access then from the individual record of the
database. Basically I want to have a short cut from the
record in the database the the target folder. If that make
sense.

Thanks in advance

Martin


-----Original Message-----
Use MkDir in the AfterInsert event procedure of the form
where records are
entered.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

message

I have a form to input jobs. When a job is being
inputted
would it to create a unique folder for that job named
after the job number field. This would be to put
word,excel and pictures relating to the specific job.
Also
could it then produce a short cut or hold the path to
the
folder on the individual record for ease of access.

Thanks in advance


Martin


.
 
If a user had a document open in that folder at the time you tried to rename
it, what would you expect to happen?

If you want to do it anyway:

1. Declare a String variable in the General Declarations section of your
form's module (top, with the Option statements).

2. In Form_BeforeUpdate, if the Value of the job number is not the same as
its OldValue, set the string to the OldValue

3. In Form_AfterUpdate, if the string is not zero-length, use the Name
statement to rename the folder from the value in the string to the current
value, and reset the string to zero-length.

The string variable is used because the OldValue property is no longer
available in the form's AfterUpdate event. If you are doing this in Access
97, you may need to be aware that it can give you the wrong answer in
Form_AfterUpdate, so you may want to use 2 string variables. Details:
http://allenbrowne.com/BugBookmark.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Is it possible to rename the folder after it has been
create, based on a change of the job number field.


Thanks

Martin

-----Original Message-----
Add a field to your table. You could use a Text field, but this example
assumes a hyperlink type field named "MyFolder".

In the BeforeUpdate event of the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strPath as String
If Me.NewRecord And Not Cancel Then
strPath = "C:\JobsInfo\" & Me![JobNumber] & [JobCode]
MkDir strPath
Me.MyFolder = strPath &"#" & strPath & "#"
End If
End Sub

If hyperlink fields are a new concept, see:
Introduction to Hyperlink fields
at:
http://allenbrowne.com/casu-09.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen I have got the basics woking with this

Dim strMyTest As String
strMyTest = Me![JobNumber] & "" & [JobCode]
ChDir ("C:\JobsInfo")
MkDir (strMyTest)

How do I store the location of the folders so that the
users can access then from the individual record of the
database. Basically I want to have a short cut from the
record in the database the the target folder. If that make
sense.

Thanks in advance

Martin


-----Original Message-----
Use MkDir in the AfterInsert event procedure of the form
where records are
entered.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

message

I have a form to input jobs. When a job is being
inputted
would it to create a unique folder for that job named
after the job number field. This would be to put
word,excel and pictures relating to the specific job.
Also
could it then produce a short cut or hold the path to
the
folder on the individual record for ease of access.

Thanks in advance


Martin
 
Back
Top