Multiple Combo + Last 5 selections

ezykiwi

Registered User.
Local time
Today, 16:47
Joined
Sep 5, 2006
Messages
33
Howdy all,
Ive got combo boxes, in a cascading style working well...
but what id like to also have is a another dropdown list that shows the last 5 selected options (because often the data will be entered in batches and it should just save time)

there is combo1 combo2 and combo3

If Sport is selected in combo1 then it displays combo2 with all the sports in it, so if golf is selected then the golf options come up in combo3 for example tiger,

So id like to store Sport > Golf > Tiger

Ive already got the value for Tiger being selected, so I can assign that easily enough

What id like to be able to do is store the name and its value in a combo box maybe showing the last 5 selections.

Im just not sure what the best way to go about this would be,
Should I make a table with say 5 rows? or is there a better way to go about it?

Any thoughts or advice would be awesome,

Cheers Ezy
 
Last edited:
Its ok, ive got the names stringing togeather nicely now,

all i need now is to be able to pass the information to a table..... where it removes the bottom entry and puts the latest at the top....

I have added a new table called Last Cat

Inside it it has
Number (which is auto number and key)
Name
CatID

I also have my form, and all the data is unbound,

What i need to be able to do, is get my two unbound text fields to add a new record into the top of the Last Cat Table, and delete the last record in the table. So that there will always be just the 5 entries, Ive put in 5 dummy ones so far

The text boxes in the form are called ... catpath and catvalue
catpath needs to go into the Name feild
catvalue needs to go into the CatID feild

anyone got any ideas?

Cheers Ezy
 
Last edited:
OK, an update,
Ive got it saving to the table, with this behind the button

Private Sub buttonsave_Click()
Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("Last Cat")
With rst
.AddNew
!catpathtxt = Me.catpath
!catid = Me.catvalue
.Update
End With
rst.Close

there is also a feild called catpathid , but its set to autonumber and that works fine....

I just need now to come up with a way to keep the table only have say 5 records, so it adds the latest record, and deletes the oldest...

any ideas?

One idea Ive came up with, is to change the catpathid to just a number, and a default value of 5

then set up 2 queries, the first one deletes the record with a catpathid of 1...

then I could run another query, that updates catpathid to = catpathid - 1 ... so basically the listing that was in 2nd spot.. will be in the number 1 spot ready for deletion the next time...

and the newest entry starts at 5....

I can get the queries working, but can i put them in the code so that when the button is pressed, it would run the delete query... then the update of the catpathids and then insert the newest record? without having to have the query messages coming up saying about the number of rows its updating etc etc....
 
Last edited:
I think i have found it

CurrentDB.Execute "name of query"
 

Users who are viewing this thread

Back
Top Bottom