Re: Reducing the List items on a combo



On your table have a Field "Selected" as a Yes/No Type

On the open of the form, change all the "Selected" to False
On the close of the form (just to make sure) change all the "Selected" to
False

Your combo box needs a sql somethin like

SELECT Material, MaterialID, Selected FROM MyTable WHERE Selected =False;
2 Columns
Bound Column Column 2
Column Width 5cms; 0 cms

The Update of the Comboboc ("Combo2"

Option Compare Database
Option Explicit

Private Sub Combo2_AfterUpdate()

Dim Mydb As Database
Dim MySet As Recordset
Dim Criteria As String

Set Mydb = CurrentDb
Set MySet = Mydb.OpenRecordset("CoInfo")

Criteria = "MaterialID = " & CLng(Combo2)

With MySet
Do Until !MaterialID = CLng(Combo2)
.MoveNext
Loop
.Edit
!Selected = True 'Then it wont be seen next time
.Update
.Close
Set MySet = Nothing
End With

Combo2.Requery

End Sub

HTH

Phil
<henry.onovwaka@xxxxxxxxx> wrote in message
news:bc5cf4f5-4ebd-412e-8a7d-6f4619386d04@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Thank you LARRY,

I quite understand the logic, but sincerely if you can give me an
example.

I am actually using a query as the source, and i want it on the
session i am currently working.

Will be glad if u could help.


.



Relevant Pages

  • Re: Problem stepping thru a record set
    ... Set MySet = MyDB.OpenRecordset("Select * from Tracked Order By ... Dim MyTable As DAO.Recordset ... Dim MyDB As DAO.Database ... Set DB = CurrentDb() ...
    (microsoft.public.access.modulesdaovba)
  • Re: Best Practice to close Database
    ... Dim SQLStg As String ... Dim MyDb As Database ... Set MySet = MyDb.OpenRecordset ... Set db = CurrentDB ...
    (comp.databases.ms-access)
  • Re: Best Practice to close Database
    ... Dim SQLStg As String ... Set MyDb = CurrentDb ... Set MySet = MyDb.OpenRecordset ... Mydb.Close will cause any existing Cloned recordsets to fail. ...
    (comp.databases.ms-access)
  • Re: Problem with Code Because I already have an Open Query
    ... Set MySet = CurrentDb.OpenRecordset ... I have already open a Query named ACCOUNTS and I want to copy the ... The code is stuck on the Set Myset=CurrentDb ... Dim PoseidonHotelProgram As Database ...
    (microsoft.public.access.forms)
  • Re: Too few parameters expected 3
    ... Your Resource For Help With Access, Excel And Word Applications ... > Dim MyDb As Database, ... > Set MySet = MyDb.OpenRecordset ...
    (microsoft.public.access.gettingstarted)