LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Deleting ? Again . . . Sorry

Hi Guys,
I asked asked this question awhile back and wasn't able to find the answer I
was looking for. So I thought I would try again, hopefully with a clearer
explanation.

1. I have a userform that contains a combo box and a listbox.
2. I select from the combo box a farmers market location
3. The list box then fills with any entries from the database that match the
combo box.
4.I can select using the curser any entry in the listbox
5.I want to add a delete button that deletes the selected entry in the list
box
6.Here is the catch: I was given a code that deletes the entry from the
listbox ONLY
7.MY NEED IS FOR THE BUTTON TO ALSO DELETE IT FROM THE DATABASE.

That's it! Thank you! I have also added what code I have. Again, Thank you.
Jennifer
Option Explicit
Private Const Sourcename As String = "ProdTable"
Private Source As Range
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Set Source = Range(Sourcename)
LoadMarkets
End Sub
Private Sub LoadMarkets()
Dim markets As New Scripting.Dictionary
Dim index As Long
Dim market As String
For index = 2 To Source.Rows.Count
market = Source.Cells(index, 1)
If Not markets.Exists(market) Then
markets.Add market, market
cmbMarket.AddItem market
End If
Next


End Sub
Private Sub cmbMarket_Change()
LoadMarketData
End Sub
Private Sub LoadMarketData()
Dim market As String
Dim index As Long

market = cmbMarket.Value
With lstProducts
.Clear
For index = 2 To Source.Rows.Count
If Source.Cells(index, 1).Value = market Then
.AddItem Source.Cells(index, 2)
.List(.ListCount - 1, 1) = Source.Cells(index, 3)
.List(.ListCount - 1, 2) = Source.Cells(index, 4)
End If
Next
End With

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting the text without deleting the formula gems04 Excel Worksheet Functions 3 January 30th 09 11:21 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"