I'm trying to help my department with a form. I have a field that we enter the document name. I would like to make this a hyperlink to the document. I would like the code look at another field. Depending on what is entered in that field, it will let you know what folder name we are going to be using. Example: if it is DCR it will go the DCR folder, if it is CR it will go to the CR folder. I've figured out a way to do it but it's not exactly correct. I would like the other specialist to be able to enter the name of their doc and the coding add the rest.
So the specialist would enter:
NC ABC 02-22-2013.pdf
Once they tab off that field, it will display as:
NC ABC 02-22-2013
Behind the scenes (pressing F2) it would be:
NC ABC 02-22-2013#S:\Support Services\DCR\NC ABC 02-22-2013.pdf#
Below is the coding that I'm using but it is assuming that all the doc names will be 17 characters in length. Also, the Hold field in the code is not necessary. I was the only way I could figure out how to keep all the info.
Private Sub FileName_AfterUpdate()
If Me.FileName.Value <> "" And Me.DCRCR.Value = "DCR" Then
Me.Hold.Value = Me.FileName.Value
Me.FileName.Value = Null
Me.FileName.Value = Left(Me.Hold.Value, 17) & "#S:\Support Services\DCR\" & Me.Hold.Value
Me.Hold.Value = Null
ElseIf Me.FileName.Value <> "" And Me.DCRCR.Value = "CR" Then
Me.Hold.Value = Me.FileName.Value
Me.FileName.Value = Null
Me.FileName.Value = Left(Me.Hold.Value, 17) & "#S:\Support Services\CRs\" & Me.Hold.Value
Me.Hold.Value = Null
ElseIf Me.FileName.Value = "" And Me.DCRCR.Value = "DCR" Then
Me.Hold.Value = Null
Me.FileName.Value = Null
ElseIf Me.FileName.Value = "" And Me.DCRCR.Value = "CR" Then
Me.Hold.Value = Null
Me.FileName.Value = Null
End If
End Sub
Any and all help is greatly appreciated.
So the specialist would enter:
NC ABC 02-22-2013.pdf
Once they tab off that field, it will display as:
NC ABC 02-22-2013
Behind the scenes (pressing F2) it would be:
NC ABC 02-22-2013#S:\Support Services\DCR\NC ABC 02-22-2013.pdf#
Below is the coding that I'm using but it is assuming that all the doc names will be 17 characters in length. Also, the Hold field in the code is not necessary. I was the only way I could figure out how to keep all the info.
Private Sub FileName_AfterUpdate()
If Me.FileName.Value <> "" And Me.DCRCR.Value = "DCR" Then
Me.Hold.Value = Me.FileName.Value
Me.FileName.Value = Null
Me.FileName.Value = Left(Me.Hold.Value, 17) & "#S:\Support Services\DCR\" & Me.Hold.Value
Me.Hold.Value = Null
ElseIf Me.FileName.Value <> "" And Me.DCRCR.Value = "CR" Then
Me.Hold.Value = Me.FileName.Value
Me.FileName.Value = Null
Me.FileName.Value = Left(Me.Hold.Value, 17) & "#S:\Support Services\CRs\" & Me.Hold.Value
Me.Hold.Value = Null
ElseIf Me.FileName.Value = "" And Me.DCRCR.Value = "DCR" Then
Me.Hold.Value = Null
Me.FileName.Value = Null
ElseIf Me.FileName.Value = "" And Me.DCRCR.Value = "CR" Then
Me.Hold.Value = Null
Me.FileName.Value = Null
End If
End Sub
Any and all help is greatly appreciated.