G
Guest
I have a form that has a number of controls on it plus a button that, when
pressed, needs to save the data selected by the user on the form to the
database. I have two use to different insert statements since I have to
insert a parent record before I insert a child. After the first insert is
successful I get a message box that has the following error message: The
expression On Click you entered as the event property setting produced the
following error: Member already exists in an object module from which this
object module derives. Any ideas? My code is as follows:
pressed, needs to save the data selected by the user on the form to the
database. I have two use to different insert statements since I have to
insert a parent record before I insert a child. After the first insert is
successful I get a message box that has the following error message: The
expression On Click you entered as the event property setting produced the
following error: Member already exists in an object module from which this
object module derives. Any ideas? My code is as follows:
Code:
Option Compare Database
Dim strNumber As String, strName As String, strDescription As String,
strImageName As String
Dim intCat_1 As Integer, intCat_2 As Integer, intCat_3 As Integer, intCat_4
As Integer, intCat_5 As Integer
Private Sub cmdAddRecord_Click()
Dim strSQL As String
Dim intAffected, intOriginal As Integer
strNumber = txtNum.Text
strName = txtName.Text
strDescription = txtDescription.Text
strImageName = txtImageName.Text
strSQL = "INSERT INTO tblProduct (strNumPK, strName, strDescription,
strImageName)" & _
"VALUES ('" & strNumber & "', '" & strName & "', '" & strDescription
& "', '" & strImageName & "')"
intCat_1 = cboCat_1.Column(0)(cboCat_1.ListIndex)
intCat_2 = cboCat_2.Column(0)(cboCat_2.ListIndex)
intCat_3 = cboCat_3.Column(0)(cboCat_3.ListIndex)
intCat_4 = cboCat_4.Column(0)(cboCat_4.ListIndex)
intCat_5 = cboCat_5.Column(0)(cboCat_5.ListIndex)
intCat_6 = cboCat_6.Column(0)(cboCat_6.ListIndex)
strSQL = "INSERT INTO tblProductJoin (intCategory_1FK, intCategory_2FK,
intCategory_3FK, intCategory_4FK, intCategory_5FK, intCategory_6FK)" & _
"VALUES (" & intCat_1 & "," & intCat_2 & "," & intCat_3 & "," &
intCat_4 & "," & intCat_5 & "," & intCat_6 & ", '" & strNumber & "')"
End Sub