473,804 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1360
Br
Lee-Anne Waters via AccessMonster.c om 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
2509
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 products). Tables: tblCategoryDetails CategoryID SpecID
12
19019
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, frmBrowseNegsSubform. I would like to perform an ascending or descending sort on any of the 7 columns shown in datasheet view in the subform control. I've been unsuccessful. Is there something tricky about sorting in subform controls?
1
2662
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 helpful too; but I'm so bad with syntax that specifics will be MOST helpful) SELECT DISTINCT ., . FROM Union Select "<ALL>" , NULL From ;
4
2730
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 can most easily deal with before being overwhelmed by choices (processing time is also a consideration, but not as important as the UI issue). In forms with large number of combo boxes, I leave row sources empty until the on got focus event...
2
1867
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 program. When the program is restarted the messages are replayed so the application knows where it is up to. I am not allowed to use a **database** I have been instructed to use a flat file. The application I am replacing does that.
1
2295
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 records displayed in the subform control. Say, for instance, to list only 2004 model cars. I'm seeking the simplest approach. The main form is frmCreateInvoice, the subform control is named frmCreateInvoiceSubFormCtl and the actual sub- form is...
3
3018
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> #include <iostream> using namespace std;
6
9433
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 report" button located on my form to print all of the list box values (that have been updated via selection from combo boxes) from the form to the report. I've tried using a macro with the code: Macro Name: cmdGenerateReport : On Click Action:...
6
1959
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, filtered contacts to the proper distribution list. I have two main forms, described below. These forms are based on three tables. Tables tbl_MainContact: Holds all contact information tbl_JoinContactToDistributionList: A join table
0
9589
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.