I have linked a bunch of pictures that are contained within a subfolder. The path is defined in the On Load and On Timer Events of a form. When the form is open, every two seconds 33 pictures flip from one to the other. It runs just perfect.
I get error message only when I make a copy of the DB from my PC to my laptop as it looks for the path as defined in my code (e.g.“C:\folder name\sbufoldern ame” etc. ).
How do I modify the codes to make it generic so that when a copy of the database is transferred from one pc to another, the links to all the pictures will also transfer and the form will open without an error message. Any help with this is much appreciated. Thanks.
Right now the code looks like this:
I get error message only when I make a copy of the DB from my PC to my laptop as it looks for the path as defined in my code (e.g.“C:\folder name\sbufoldern ame” etc. ).
How do I modify the codes to make it generic so that when a copy of the database is transferred from one pc to another, the links to all the pictures will also transfer and the form will open without an error message. Any help with this is much appreciated. Thanks.
Right now the code looks like this:
Code:
Private Sub Form_Load() Me.TimerInterval = 2000 ShowImage Me.Image1, "C:\HRS_DATABASE\MenuPics\Waheed.jpg" End Sub
Code:
Private Sub Form_Timer()
' on any error go to Err_Form_Timer
On Error GoTo Err_Form_Timer
Static i As Integer
Dim path As String
Dim path1 As String
Dim iString As String
path = "C:\HRS_DATABASE\MenuPics\C-"
path1 = ".jpg"
If i = 33 Then
i = 1
Else
i = i + 1
End If
iString = i
Select Case i
Case i
ShowImage Me.Image1, path & iString & path1
End Select
Exit_Form_Timer:
Exit Sub
Err_Form_Timer:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Form_Timer:
End Sub
Comment