A
Amit
Hi there,
I am getting a compile error that says "user-defined type
not defined" with the following code:
==================================
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
Dim varItem As Variant
Dim strSql As String
Dim db As Database <-----error on this line
Set db = CurrentDb()
For Each varItem In Me.List2.ItemsSelected
strSql = "Insert Into tblPersonColor (PersonID,
ColorID) Values (" & _
Me.ID & ",'" & Me.List2.ItemData(varItem)
& "')"
db.Execute strSql
Next varItem
Set db = Nothing
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
======================================
This code is in the "On Click" event for a button to
select items from a list. If someone can help me with
this, I'll appreciate that.
Tx.
-Amit
I am getting a compile error that says "user-defined type
not defined" with the following code:
==================================
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
Dim varItem As Variant
Dim strSql As String
Dim db As Database <-----error on this line
Set db = CurrentDb()
For Each varItem In Me.List2.ItemsSelected
strSql = "Insert Into tblPersonColor (PersonID,
ColorID) Values (" & _
Me.ID & ",'" & Me.List2.ItemData(varItem)
& "')"
db.Execute strSql
Next varItem
Set db = Nothing
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
======================================
This code is in the "On Click" event for a button to
select items from a list. If someone can help me with
this, I'll appreciate that.
Tx.
-Amit