abroniewski
Registered User.
- Local time
- Today, 15:01
- Joined
- Oct 11, 2011
- Messages
- 14
Hi!
I am creating a database and I have gotten stuck on the searching functionality. I am creating a form with several list boxes. The user chooses catagorie(s) to search through from these multiselect listboxes.
The catagories come from a table named Classifications where each colomn is a different catagory (listbox). I want the selected items to be saved to a table (named tblSearchFields, which has the same headings as Classifications), which will then be used to form the criteria of a query.
The error I am currently receiving is "3021: No current record".
The code I have so far:
Private Sub lstProjectPhase_Click()
Dim var As Variant
Dim lst As ListBox
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = CurrentDb.OpenRecordset("tblSearchFields", dbOpenDynaset)
Set lst = lstProjectPhase
rst.MoveFirst *****This is where the highlighted error occurs
For Each var In lst.ItemsSelected
rst![Project Phases] = lst.ItemData(var)
Next var
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Thanks for your help!
Adam
I am creating a database and I have gotten stuck on the searching functionality. I am creating a form with several list boxes. The user chooses catagorie(s) to search through from these multiselect listboxes.
The catagories come from a table named Classifications where each colomn is a different catagory (listbox). I want the selected items to be saved to a table (named tblSearchFields, which has the same headings as Classifications), which will then be used to form the criteria of a query.
The error I am currently receiving is "3021: No current record".
The code I have so far:
Private Sub lstProjectPhase_Click()
Dim var As Variant
Dim lst As ListBox
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = CurrentDb.OpenRecordset("tblSearchFields", dbOpenDynaset)
Set lst = lstProjectPhase
rst.MoveFirst *****This is where the highlighted error occurs
For Each var In lst.ItemsSelected
rst![Project Phases] = lst.ItemData(var)
Next var
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Thanks for your help!
Adam