By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Please Help - Combo Box Question...

P: n/a
Dear Access Users,

I have a form with a combo box and a button on it. The combo box has
a list of all the records in the database. When the user pushes the
button, a macro runs that deletes the record (which is made up of
several tables) from the database. No sweat! The problem: The owner
of this database has requested that several hundred records be
deleted. I can very easily change the query that powers the combo box
so that it only lists a certain year's records.

Is there any way when the button is pressed, that code will start at
the first record listed in the pull down and work down to the next and
the next and so on until all of the records listed are deleted? If I
need to change it to a list box, no sweat.

Thanks a million in advance!

Kevin
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
No Spam wrote:
Dear Access Users,

I have a form with a combo box and a button on it. The combo box has
a list of all the records in the database. When the user pushes the
button, a macro runs that deletes the record (which is made up of
several tables) from the database. No sweat! The problem: The owner
of this database has requested that several hundred records be
deleted. I can very easily change the query that powers the combo box
so that it only lists a certain year's records.

Is there any way when the button is pressed, that code will start at
the first record listed in the pull down and work down to the next and
the next and so on until all of the records listed are deleted? If I
need to change it to a list box, no sweat.

Thanks a million in advance!

Kevin


This routine might give you some further insight into combos. Create a
new form and create a new combo that uses a small table of 20 records or
less (so you can see/verify the results). Call the combo Combo0.

Copy the code below into the event.

I'll assume the first column is the key. Change the col value of what
you want to see where I make reference to Column.

Try it with column headings on and headings off.

Private Sub Combo0_Click()
Dim lngCnt As Long
Dim intFor As Long
lngCnt = Me.Combo0.ListCount - 1
Dim strVar As String
For intFor = lngCnt To 0 + Abs(Me.Combo0.ColumnHeads) Step -1
'change Column(1, to another column if you like
strVar = strVar & Me.Combo0.ItemData(intFor) & " " & _
Me.Combo0.Column(1, intFor) & vbNewLine
Next
MsgBox strVar

End Sub
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.