Hello. I have a switch board(Not made with wizard)it has a picture on it, would very much like for picture to change when switch board is opened.
Private Sub Form_Current()
Dim path As String
'The Me.Filename is the name of a text box that holds the filename. As you change records if you have the field filled in with a valid filename the image will appear.
If Me.Filename <> "" Then
path = "C:\Users\Documents\Pictures\pictures"
Me.Image1.Picture = path & Me.Filename
End If
End Sub
Works good! (Thanks ZiggyS1)
I have created a table with the names of my pictures and a combobox populated by a select statement from this table.
Need help in how to auto move to next position in combobox on, on current event(or some better idea), attempting
Private Sub Form_Current()
On Error GoTo Error_Handler
Dim path As String
'The Me.Filename is the name of a text box that holds the filename. As you change records if you have the field filled in with a valid filename the image will appear.
If Me.FileName <> "" Then
Me.FileName.ListIndex = Me.FileName.ListIndex + 1
path = "C:\Users\Timothy L Hanson\Pictures\pictures\"
Me.Image1.Picture = path & Me.FileName & ".jpg"
Error_Handler:
If Err.Number = 7777 Then
' End of the list - Move to the start.
Me.FileName.ListIndex = 0
Exit Sub
Else
MsgBox Err.Description, vbOKOnly, "Error #" & _
Err.Number & " occurred"
End If
End If
End Sub
not working keep getting Err 7777
Private Sub Form_Current()
Dim path As String
'The Me.Filename is the name of a text box that holds the filename. As you change records if you have the field filled in with a valid filename the image will appear.
If Me.Filename <> "" Then
path = "C:\Users\Documents\Pictures\pictures"
Me.Image1.Picture = path & Me.Filename
End If
End Sub
Works good! (Thanks ZiggyS1)
I have created a table with the names of my pictures and a combobox populated by a select statement from this table.
Need help in how to auto move to next position in combobox on, on current event(or some better idea), attempting
Private Sub Form_Current()
On Error GoTo Error_Handler
Dim path As String
'The Me.Filename is the name of a text box that holds the filename. As you change records if you have the field filled in with a valid filename the image will appear.
If Me.FileName <> "" Then
Me.FileName.ListIndex = Me.FileName.ListIndex + 1
path = "C:\Users\Timothy L Hanson\Pictures\pictures\"
Me.Image1.Picture = path & Me.FileName & ".jpg"
Error_Handler:
If Err.Number = 7777 Then
' End of the list - Move to the start.
Me.FileName.ListIndex = 0
Exit Sub
Else
MsgBox Err.Description, vbOKOnly, "Error #" & _
Err.Number & " occurred"
End If
End If
End Sub
not working keep getting Err 7777
Last edited: