Images
Image selection can be added to any table that stores an image path.
In the Controller:
Public Function SetSongImage(lngSongId As Long, strImagePath As String) As BooleanDim song As cls_songs
On Error GoTo Error_Handler
SetSongImage = False
Set song = New cls_songs song.Load (lngSongId) song.image_path = strImagePath song.Update
SetSongImage = True
Cleanup: Set song = Nothing Exit Function
Error_Handler: GeneralErrorHandler err, MODULE_NAME, "SetSongImage" Resume CleanupEnd FunctionIn the form with an image:
Private Sub edtPicture_DblClick(Cancel As Integer)Dim strImagePath As StringDim strInitialSearchDirectory As String
On Error GoTo Error_Handler
strInitialSearchDirectory = SongController.IMAGE_DIRECTORY
strImagePath = modImageSelector.GetImagePath(strInitialSearchDirectory)
If strImagePath = "" Then Exit Sub End If
If SongController.SetSongImage(Me.txtID, strImagePath) Then Me.edtPicture.Requery End If
Cleanup: Exit Sub
Error_Handler: GeneralErrorHandler err, MODULE_NAME, "edtPicture_DblClick" Resume CleanupEnd Sub