Imdabaum
07-26-2006, 03:02 PM
I have two tables that are being affected. One purposefully, and the second one is a bug. tblDisplayImage stores a Master Image to be displayed in a Profile. It is selected from tblPhotos.
I have a main form that holds information from users. There is a photos subform, that allows users to add photos to their page. The form has a listbox that allows you to display the photo selected Where ID= UserID. This listbox is populated from tblPhotos with same criteria.
Then I have a form that sets the value of imageLocation in tblDisplayImage. The selection is made by selecting a photo from a combo box that is populated from tblPhotos Where ID= userID. I have a button that performs the following operation when I have selected the desired photo from the Combo box.
Private Sub cmdsetImage_Click()
Dim imgAddress As String
Dim imgCaption As String
Dim strCriteria As String
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
strCriteria = "ID = " & Me.UserID
Set rst = db.OpenRecordset("tblDisplayImages", dbOpenDynaset)
If Not IsNull(Me.cboImages.Column(2)) Then
imgAddress = Me.cboImages.Column(2)
Else
imgAddress = vbNullChar
End If
rst.FindFirst strCriteria
If rst.NoMatch Then
With rst
.AddNew
!PropertyID = Me.PropertyID
!location = imgAddress
.Update
rst.Close
End With
Else
With rst
.Edit
!PropertyID = Me.PropertyID
!location = imgAddress
.Update
rst.Close
End With
End If
DoCmd.Close acForm, "frmTitleImageSelect"
End Sub
For some reason when we click the accept button it changes the caption value for the first item in the subForm's listbox.
I have a main form that holds information from users. There is a photos subform, that allows users to add photos to their page. The form has a listbox that allows you to display the photo selected Where ID= UserID. This listbox is populated from tblPhotos with same criteria.
Then I have a form that sets the value of imageLocation in tblDisplayImage. The selection is made by selecting a photo from a combo box that is populated from tblPhotos Where ID= userID. I have a button that performs the following operation when I have selected the desired photo from the Combo box.
Private Sub cmdsetImage_Click()
Dim imgAddress As String
Dim imgCaption As String
Dim strCriteria As String
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
strCriteria = "ID = " & Me.UserID
Set rst = db.OpenRecordset("tblDisplayImages", dbOpenDynaset)
If Not IsNull(Me.cboImages.Column(2)) Then
imgAddress = Me.cboImages.Column(2)
Else
imgAddress = vbNullChar
End If
rst.FindFirst strCriteria
If rst.NoMatch Then
With rst
.AddNew
!PropertyID = Me.PropertyID
!location = imgAddress
.Update
rst.Close
End With
Else
With rst
.Edit
!PropertyID = Me.PropertyID
!location = imgAddress
.Update
rst.Close
End With
End If
DoCmd.Close acForm, "frmTitleImageSelect"
End Sub
For some reason when we click the accept button it changes the caption value for the first item in the subForm's listbox.