473,396 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

deleting records from list boxes

Hi,

would someone please help me with this problem.

i have a list box that displays a persons various sub records. what i want to do is to be able to double click a list box record and have it deleted.

i'm just not sure on what code i need to do this

many thanks

Lee-Anne

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
2 1339
Br
Lee-Anne Waters via AccessMonster.com wrote:
Hi,

would someone please help me with this problem.

i have a list box that displays a persons various sub records. what i
want to do is to be able to double click a list box record and have
it deleted.

i'm just not sure on what code i need to do this

many thanks

Lee-Anne


On the listbox's Double-Click event add some code that will reference
the ListBox's value (bound the the ID of the selected record) and then
add some code to delete that record from the table (or use an SQL
statement/query).

It might look something like...

Dim myID as Long, mySQL as String

myID = Me![myListbox]
mySQL = "DELETE * FROM tblMyTable WHERE [myTableID] = " & myID & ";"
DoCmd.RunSQL mySQL

Hope that gives you somethig to work with. Oh and don't forget to
requery your listbox after you removed the record.

Me![myListBox].Requery

Br@dley
Nov 13 '05 #2
thanks Br@dley.. you're a legend :)

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
4
by: Tim Marshall | last post by:
Does anyone have recommendations for the maximum number of records a combo box should return? I'm not talking about limits in Access itself, but rather for UI purposes, ie, what the average user...
2
by: Stuart Norris | last post by:
Dear Readers, I am developing an application that stores "messages" in array list and writes new entries to a disk file at the end. This file is used incase the user choses to restart the...
1
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the...
3
by: Daz01 | last post by:
How do I delete records? Ive written a program that can add new records and I can display what I've entered, but how do I select certain records to delete? Code below #include <cstdlib>...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
6
by: Nettle | last post by:
Purpose: I am creating a mailing distribution list database. Users should be able to filter/search contacts and add them to distribution lists they have created. My problem? I can't add multiple,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.