Hi Joan I must say thank you for you patience
Well we are getting a lot nearer it how comes up with the following error
Unable to open (then the correct folder path followed by)cannot find
specified file (yet it is displaying the correct path now every time
including the correct folder number)
I have also tried L:\Open Files instead of \\Dgt04y2j\L\Open Files but it
makes no difference both ways comes up with the correct folder path and
displays the folder number.
Yet the way we started did find and open the file with the following:
Me.Command797.HyperlinkAddress =L:\Open Files\Open 38001 To 38100" &
Me.CustomerID (this works every time in this folder group)
The only difference as I can see is we have named the last folder.
Regards and thanks Bob
Good grief; I got so caught up in getting the concatenation correct, I
forgot the actual command to open the hyperlink...
After the End If
Me.Command796.HyperlinkAddress = strPath
--
Joan Wild
Microsoft Access MVP
: The code is correct as follows:
:
: Private Sub Command796_Click()
: Dim strPath As String
: Dim strFolder As String
: If Me.Dirty Then Me.Dirty = False
:
: strFolder = (Me.CustomerID \ 100) * 100 + 1 & " To " & (Me.CustomerID \
100)
: * 100 + 100 & "\"
: If Me.RecordComplete = True Then
: strPath = "\\Dgt04y2j\L\Closed Files\" & strFolder & Me.CustomerID
: Else
: strPath = "\\Dgt04y2j\L\Open Files\" & strFolder & Me.CustomerID
: End If
:
: Other button deleted
:
: Nothing happens when you click the button
:
: Regards Bob
:
: End Sub
: : The number and names of the command buttons is confusing. Do you actually
: have two command buttons on your form? If you only have one then get rid
of
: the code for the other. I also suggest you give the command button a
decent
: name e.g. GoToFile (open the property sheet while the Command button is
: selected and on the Other tab modify the name property). The code that
: works seems to have a different path i.e. there's an 'OPEN' in it after
the
: Open Files\
: > Me.Command796.HyperlinkAddress = "\\Dgt04y2j\T\Open Files\OPEN 38001 TO
: > 38100\" & Me.CustomerID
: You also have a typo on the strFolder line - Cutomer instead of Customer
: I've added an additional line, in case the record isn't saved when you
click
: the button
:
: Private Sub GoToFile_Click()
: Dim strPath As String
: Dim strFolder As String
:
: If Me.Dirty Then Me.Dirty = false
: strFolder = (Me.CustomerID \ 100) * 100 + 1 & " To " & (Me.CustomerID \
: 100) * 100 + 100 & "\"
:
: If Me.RecordComplete = True Then
: strPath = "\\Dgt04y2j\E\Closed Files\" & strFolder & Me.CustomerID
: Else
: 'don't know whether the OPEN should be here or not; and if so should the
: above have a CLOSED in it?
: strPath = "\\Dgt04y2j\T\Open Files\OPEN" & strFolder & Me.CustomerID
: End If
: End Sub
:
: > The way I read the code it could be from 1 in groups of 100 then in
would
: > go
: > up to 10100 (100*100+100) is that correct? properly not
what does
the
: > &
: > "\" bit do?
:
: It takes the CustomerID (say 14512) and then \100 which will divide by 100
: and return the integer result which is 145 then *100 to multiply by 100,
: then add 1 - the result is 14501
: The & concatenates that with a space followed by To followed by another
: space, so now we have
: 14501 To
: Then CustomerID\100 gives us 145; the *100 gives 14500; the +100 gives us
: 14600, so now we have
: 14501 To 14600
: Then concatenate the \ (needed in the path)
: 14501 To 14600\ is the strFolder
: I tested this with 7012 and it works.
: The strPath builds up the path using strFolder eg.
:
: "\\Dgt04y2j\E\Closed Files\" & strFolder & Me.CustomerID
: would be
: "\\Dgt04y2j\E\Closed Files\14501 To 14600\14512
:
:
: --
: Joan Wild
: Microsoft Access MVP
: :: Joan it now sort of works if you click the command button nothing happens
: if
:: you click the first command button for the first piece of code you sent
me
::
:: Private Sub Command797_Click()
:: Me.Command796.HyperlinkAddress = "\\Dgt04y2j\T\Open Files\OPEN 38001 TO
:: 38100\" & Me.CustomerID
:: End Sub
::
:: Nothing happens because the Command should have been 797 not 796 (But if
:: you correct this yes it works)
:: But if you then hit the second command796 button it works and goes to the
:: correct folder. Say 38020
::
:: If you then scroll through 2 or 3 records and re hit the command796
button
:: it still goes to folder 38020 in stead of say record 38023
::
:: If you hit the first button and then the second button it goes to the
:: correct record.
::
:: As you can see I have set it up to the server address and the code is now
: as
:: follows:
::
:: Private Sub Command796_Click()
:: Dim strPath As String
:: Dim strFolder As String
:: strFolder = (Me.CustomerID \ 100) * 100 + 1 & " To " & (Me.CutomerID \
: 100)
:: * 100 + 100 & "\"
:: If Me.RecordComplete = True Then
:: strPath = "\\Dgt04y2j\E\Closed Files\" & strFolder & Me.CustomerID
:: Else
:: strPath = "\\Dgt04y2j\T\Open Files\" & strFolder & Me.CustomerID
:: End If
:: End Sub
::
:: I hope you followed that if you hit command796 nothing happens but if you
:: hit the wrongly coded Command 797 and then the Command796 the Command796
:: works.
::
:: I was wondering if the record range is wrong the first folder is 7001 To
:: 7100 and there is of course no maximum as new folder are added every day.
: We
:: are currently in the 39000 range.
:: The way I read the code it could be from 1 in groups of 100 then in would
: go
:: up to 10100 (100*100+100) is that correct? properly not
what does the
: &
:: "\" bit do?
::
:: Thanks for your help Bob
::
:: :: Sorry Bob, I've taken a closer look, it should be
:: strFolder = (Me.CustomerID\100)*100+1 & " To " &
: (Me.CustomerID\100)*100+100
:: & "\"
::
:: (drop the first ' " ')
::
:: --
:: Joan Wild
:: Microsoft Access MVP
:: :: > Joan it is all on one line but still produces the same error.
:: >
:: > Yes we do have a tick box for closed files I will change that to the
: field
:: > name.
:: >
:: > Bob
:: > :: > :: >> Hi Joan that produces 2 errors the first in line
:: >>
:: >> strFolder = "(Me.CustomerID\100)*100+1 & " To " &
:: >> (Me.CustomerID\100)*100+100 & "\"
:: >> it high lights the word TO the error message is expecteded end of
:: >> statement
:: >
:: > That should all be on one line
:: >
:: >> And the second in
:: >> If Me.closed= true then
:: >> this produces Method or data not found
:: >
:: > You need to replace 'closed' with the actual name of the field you use
: (I
:: > assumed some yes/no field to indicate whether the file is closed or
: not).
:: >
:: >
:: > --
:: > Joan Wild
:: > Microsoft Access MVP
:: >>
:: >
:: >
::
::
:
: