Clear Image on New Record

kidzmom3

Member
Local time
Today, 09:12
Joined
Jan 25, 2002
Messages
39
I know we've visited this topic before, but I still can't get it working properly. I have an image path I'm storing in my table with a link to an image (object) control on my form. Works great, except when I go to a new record. The image control is displaying the previous records image until I add the new image path for the new record. You'll notice I have a REM for one additional line I tried that didn't correct the problem! Any fresh ideas? As always thanks all for you advice!

Private Sub Form_AfterInsert()
Me!Path = ""
Me![Image].Picture = Me![Path]
REM Me!Image = ""
End Sub

:confused:
 
I have done something similar, I have a form containing a subform. When the user clicks anything on the form or the subform I call - MoveToNextOperation(). This updates all controls to reflect the currently selected record on the subform:

Public Sub MoveToNextOperation(theForm As Form)
Dim rs As Recordset

' update picture and memo field to reflect the op selected
Set rs = theForm.RecordsetClone
If rs.RecordCount Then ' has got some records!
rs.MoveFirst
rs.Move (theForm.CurrentRecord - 1)

If Not rs.EOF Then
If Not IsNull(rs!Notes) Then Forms!ProcessForm!txtNotes = rs!Notes ' update notes field

If Not IsNull(rs!PictureLocation1) Then Forms!ProcessForm!txtPicLocation1 = rs!PictureLocation1 ' update picture control with file path string

Call RefreshPicture(1) ' refresh control
End If
End If
rs.Close
'
End Sub



Public Sub RefreshPicture(nPicCtrl As Integer)
Select Case nPicCtrl
Case 1:
If IsNull(Forms!ProcessForm!txtPicLocation1) Then
Forms!ProcessForm!Pic1.Picture = ""
Else
Forms!ProcessForm!Pic1.Picture = Forms!ProcessForm!txtPicLocation1
End If
End Select
End Sub


Let me know if this works for you!
 

Users who are viewing this thread

Back
Top Bottom