S
Spydii
Hello
I’m totally stuck! I’m using the code below to populate a list box
(Command36) & then to allow deletions from the list box (Command39). The
Command36 button works fine but when I click on an item in my list box & then
press the Command39 button I get this error message - ‘Compile Error: Method
or data member not found’ and the ‘.ContactID’ is highlighted.
Private Sub Command36_Click()
Dim MySet As Recordset
Set MySet = CurrentDb().OpenRecordset("tbl C")
If Me.Dirty Then Me.Dirty = False
MySet.AddNew
MySet![ContactID] = [ContactID]
MySet![Course Title] = Combo34.Column(0)
MySet![Location] = Combo34.Column(1)
MySet![Date] = Combo34.Column(2)
MySet![Time] = Combo34.Column(3)
MySet![Room] = Combo34.Column(4)
MySet![Developer] = Combo34.Column(5)
MySet![CourseID] = Combo34.Column(6)
MySet.Update
MySet.Close
List32.Requery
Combo34 = Null
Combo34.Requery
End Sub
Private Sub Command39_Click()
Dim MySet As Recordset, varItem As Variant
For Each varItem In List32.ItemsSelected
Set MySet = CurrentDb.OpenRecordset("tbl C", dbOpenDynaset)
MySet.FindFirst "[ContactID] = " & Me.ContactID & "And [Course Title] = '"
& List32.Column(0) & "'"
MySet.Delete
MySet.Close
Next varItem
List32.Requery
End Sub
Unfortunately, I don’t actually understand the code as I’ve somehow managed
to create two databases successfully by altering all sorts of code found in
the discussion pages by trial & error, hence my lack of understanding of this
particular problem. I’m even more confused because I use the code below to
populate and delete from another list box on another form and this works fine.
Please let me know if I need to provide anymore information; as I don’t
understand the code or what’s gone wrong I didn’t really know what to include
other than the code.
Thanks in advance for any help.
Private Sub Command131_Click()
Dim MySet As Recordset
Set MySet = CurrentDb().OpenRecordset("tbl PROJECT DETAILS")
If Me.Dirty Then Me.Dirty = False
MySet.AddNew
MySet![CompanyID] = [CompanyID]
MySet![Project Name] = Combo125.Column(0)
MySet![ProjectID] = Combo125.Column(1)
MySet![ERDF Date of Registration] = Text129
MySet![Company Status] = Combo133.Column(0)
MySet.Update
MySet.Close
List127.Requery
Combo125 = Null
Combo125.Requery
Combo133 = Null
Combo133.Requery
End Sub
Private Sub Command132_Click()
Dim MySet As Recordset, varItem As Variant
For Each varItem In List127.ItemsSelected
Set MySet = CurrentDb.OpenRecordset("tbl PROJECT DETAILS", dbOpenDynaset)
MySet.FindFirst "[CompanyID] = " & Me.CompanyID & "And [Project Name] = '"
& List127.Column(0) & "'"
MySet.Delete
MySet.Close
Next varItem
List127.Requery
End Sub
I’m totally stuck! I’m using the code below to populate a list box
(Command36) & then to allow deletions from the list box (Command39). The
Command36 button works fine but when I click on an item in my list box & then
press the Command39 button I get this error message - ‘Compile Error: Method
or data member not found’ and the ‘.ContactID’ is highlighted.
Private Sub Command36_Click()
Dim MySet As Recordset
Set MySet = CurrentDb().OpenRecordset("tbl C")
If Me.Dirty Then Me.Dirty = False
MySet.AddNew
MySet![ContactID] = [ContactID]
MySet![Course Title] = Combo34.Column(0)
MySet![Location] = Combo34.Column(1)
MySet![Date] = Combo34.Column(2)
MySet![Time] = Combo34.Column(3)
MySet![Room] = Combo34.Column(4)
MySet![Developer] = Combo34.Column(5)
MySet![CourseID] = Combo34.Column(6)
MySet.Update
MySet.Close
List32.Requery
Combo34 = Null
Combo34.Requery
End Sub
Private Sub Command39_Click()
Dim MySet As Recordset, varItem As Variant
For Each varItem In List32.ItemsSelected
Set MySet = CurrentDb.OpenRecordset("tbl C", dbOpenDynaset)
MySet.FindFirst "[ContactID] = " & Me.ContactID & "And [Course Title] = '"
& List32.Column(0) & "'"
MySet.Delete
MySet.Close
Next varItem
List32.Requery
End Sub
Unfortunately, I don’t actually understand the code as I’ve somehow managed
to create two databases successfully by altering all sorts of code found in
the discussion pages by trial & error, hence my lack of understanding of this
particular problem. I’m even more confused because I use the code below to
populate and delete from another list box on another form and this works fine.
Please let me know if I need to provide anymore information; as I don’t
understand the code or what’s gone wrong I didn’t really know what to include
other than the code.
Thanks in advance for any help.
Private Sub Command131_Click()
Dim MySet As Recordset
Set MySet = CurrentDb().OpenRecordset("tbl PROJECT DETAILS")
If Me.Dirty Then Me.Dirty = False
MySet.AddNew
MySet![CompanyID] = [CompanyID]
MySet![Project Name] = Combo125.Column(0)
MySet![ProjectID] = Combo125.Column(1)
MySet![ERDF Date of Registration] = Text129
MySet![Company Status] = Combo133.Column(0)
MySet.Update
MySet.Close
List127.Requery
Combo125 = Null
Combo125.Requery
Combo133 = Null
Combo133.Requery
End Sub
Private Sub Command132_Click()
Dim MySet As Recordset, varItem As Variant
For Each varItem In List127.ItemsSelected
Set MySet = CurrentDb.OpenRecordset("tbl PROJECT DETAILS", dbOpenDynaset)
MySet.FindFirst "[CompanyID] = " & Me.CompanyID & "And [Project Name] = '"
& List127.Column(0) & "'"
MySet.Delete
MySet.Close
Next varItem
List127.Requery
End Sub