Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default VBA Deleting in database from list box

Bob gave me the following code last night and it works but i also need it to
look at the database and delete the entire row not just in the list box.
Thank you in advance.


To delete the selected item, just use

lstData.RemoveItem (lstData.ListIndex)


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jennifer" wrote in message
...
Well it's been awhile. This stuff can just take over your life that when i
lay off for a bit it ends up being a long spell. Well this should be easy.
I have a userform with a list box containing 8 columns when i click on a

row
in the list box it fills the labels. I would like the option of deleting

the
entire row they see fit. I attached my update button just to give you an

idea
of what is going on. Thank you. Jennifer

Private Sub btnUpdate_Click()
Dim pointer As String
pointer = lstData.ListIndex
If pointer = -1 Then Exit Sub


For index = 2 To source.Rows.Count
If source.Cells(index, 1) = txtDataID.Text Then

With source
.Cells(index, eBoxes.Vendor) = txtVendor.Text
.Cells(index, eBoxes.MiscCosts) = txtMiscCosts.Text
.Cells(index, eBoxes.ProduceID) = Trim(txtProduceID.Text)

.Cells(index, eBoxes.PalletNum) = txtPallet.Text
.Cells(index, eBoxes.QtyPurchased) = txtQty.Text
.Cells(index, eBoxes.QtySold) = txtSold.Text
.Cells(index, eBoxes.Price) = txtPrice.Text
.Cells(index, eBoxes.Frt) = txtFrt.Text
End With

Exit For

End If
Next

LoadData
lstData.ListIndex = pointer

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer




Did this post answer


--
Though daily learning, I LOVE EXCEL!
Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Deleting in database from list box

I responded in the original thread.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jennifer" wrote in message
...
Bob gave me the following code last night and it works but i also need it

to
look at the database and delete the entire row not just in the list box.
Thank you in advance.


To delete the selected item, just use

lstData.RemoveItem (lstData.ListIndex)


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jennifer" wrote in message
...
Well it's been awhile. This stuff can just take over your life that when

i
lay off for a bit it ends up being a long spell. Well this should be

easy.
I have a userform with a list box containing 8 columns when i click on a

row
in the list box it fills the labels. I would like the option of deleting

the
entire row they see fit. I attached my update button just to give you an

idea
of what is going on. Thank you. Jennifer

Private Sub btnUpdate_Click()
Dim pointer As String
pointer = lstData.ListIndex
If pointer = -1 Then Exit Sub


For index = 2 To source.Rows.Count
If source.Cells(index, 1) = txtDataID.Text Then

With source
.Cells(index, eBoxes.Vendor) = txtVendor.Text
.Cells(index, eBoxes.MiscCosts) = txtMiscCosts.Text
.Cells(index, eBoxes.ProduceID) =

Trim(txtProduceID.Text)

.Cells(index, eBoxes.PalletNum) = txtPallet.Text
.Cells(index, eBoxes.QtyPurchased) = txtQty.Text
.Cells(index, eBoxes.QtySold) = txtSold.Text
.Cells(index, eBoxes.Price) = txtPrice.Text
.Cells(index, eBoxes.Frt) = txtFrt.Text
End With

Exit For

End If
Next

LoadData
lstData.ListIndex = pointer

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer




Did this post answer


--
Though daily learning, I LOVE EXCEL!
Jennifer



Reply
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
getting a list from a database WAN Excel Discussion (Misc queries) 1 August 11th 09 11:53 AM
Automatically Deleting a List from Another (Larger) List [email protected] Excel Discussion (Misc queries) 2 August 21st 07 08:31 PM
Deleting in a list box Jennifer Excel Programming 6 January 10th 06 11:06 PM
database list gtsch Excel Discussion (Misc queries) 6 December 14th 05 06:18 PM
Deleting data in userform and database Jennifer Excel Programming 1 July 13th 05 02:00 PM


All times are GMT +1. The time now is 01:40 AM.

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

About Us

"It's about Microsoft Excel"