storing Multiselect Listbox selections - Access 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the following code

Private Sub lstTo_Exit(Cancel As Integer
Dim db As DAO.Databas
Dim rst As DAO.Recordse
Dim i As Intege

Set db = CurrentDb(
Set rst = fenormioc.OpenRecordset("tblToFromCopy", DB_OPEN_DYNASET

For i = 0 To lstTo.ListCount -
If lstTo.Selected(i) The
rst.AddNe
rst!ContactID = lstTo.Column(0, i
rst!Type = "To
rst.Updat
lstTo.Selected(i) = False 'clears the selectio
End I
Next
End Su

My db is fenormioc, the table for stored selections is tblToFromCopy, the listbox is lstTo. I get the message Compile Error: Method or data member not found at .OpenRecordset. I have very limited experience in programming so please keep it simple for me! Thanks!
 
If "fenormioc" is the current database, use:

Set rst = db.OpenRecordset("tblToFromCopy", DB_OPEN_DYNASET)


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Robbie M said:
I am using the following code:

Private Sub lstTo_Exit(Cancel As Integer)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer

Set db = CurrentDb()
Set rst = fenormioc.OpenRecordset("tblToFromCopy", DB_OPEN_DYNASET)

For i = 0 To lstTo.ListCount - 1
If lstTo.Selected(i) Then
rst.AddNew
rst!ContactID = lstTo.Column(0, i)
rst!Type = "To"
rst.Update
lstTo.Selected(i) = False 'clears the selection
End If
Next i
End Sub

My db is fenormioc, the table for stored selections is tblToFromCopy, the
listbox is lstTo. I get the message Compile Error: Method or data member
not found at .OpenRecordset. I have very limited experience in programming
so please keep it simple for me! Thanks!
 
That was it - thanks so much!

----- Cheryl Fischer wrote: ----

If "fenormioc" is the current database, use

Set rst = db.OpenRecordset("tblToFromCopy", DB_OPEN_DYNASET


hth
-
Cheryl Fische
Law/Sys Associate
Houston, T

Robbie M said:
I am using the following code
Dim db As DAO.Databas
Dim rst As DAO.Recordse
Dim i As Intege
Set rst = fenormioc.OpenRecordset("tblToFromCopy", DB_OPEN_DYNASET
If lstTo.Selected(i) The
rst.AddNe
rst!ContactID = lstTo.Column(0, i
rst!Type = "To
rst.Updat
lstTo.Selected(i) = False 'clears the selectio
End I
Next
End Su
listbox is lstTo. I get the message Compile Error: Method or data membe
not found at .OpenRecordset. I have very limited experience in programmin
so please keep it simple for me! Thanks
 
Back
Top