473,441 Members | 1,459 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,441 software developers and data experts.

Delete button coding

2
I am a student and i am familiar with vb but not familar at all with vba i have picked up a couple books but nothing in these books seem to work with this problem. I have a form with a list box that pulls data from a table i want to create a button that will delete the selected item in the list box and all the records related to this item as per the the key row. Can some one give me some guidance on this thank you in advance scott
Aug 23 '07 #1
3 1565
JKing
1,206 Expert 1GB
Hi there. We have fairly strict rules as per dealing with homework questions for students. Guidelines Though I won't give you the code I will try to explain the logic.

The gist of what you want to do is on the click event run a delete query that will remove all records in the table where the key is equal to the key of the selected listbox item. Assuming your listbox is drawing it's source from the table or a query of this table simply requery the listbox to update and remove any deleted items.

Try attempting this and if you run into any errors we can help you debug your code but we cannot provide a full solution.
Aug 23 '07 #2
nub65
2
Ok thank you i want to elaborate a little more on the problem. I try to declare a variable as database or currentdatabase none of these commands are recognized neither is the command of sqldef
Aug 23 '07 #3
JKing
1,206 Expert 1GB
Sounds like you are missing a reference. In the VBA editor check under Tools > References and make sure you have Microsoft DAO Object library checked.

If that doesnt fix it, post the code you are having trouble with.
Aug 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
4
by: DrData | last post by:
I'm working on an ASP.Net application written in C#. On one page, there are several datagrid controls used to display, edit and delete detail records relating to the master record also displayed on...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
6
by: Joemanc | last post by:
I've converted my VB6 app to VB.NET 2003. For some strange reason, the delete key will not work in any of my textboxes in the application. The backspace key works just fine. The delete key works in...
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
4
by: wim taerwe | last post by:
Hello, I am looking for an easy way to have a delete button per subitem in 1 form. For example : a book can have many authors and when I edit the book details I want to have a list of the...
1
by: nico3334 | last post by:
I am trying to delete all records from all tables in Access through VB coding. I would like to do it dynamically in case new tables are added. Here is what I have so far: I have a form with a...
2
by: Danielle | last post by:
Hello all - Thank you in advance for any help you are able to provide. I am populating a gridview from a stored procuedure. The returned data is a name, phone number, email and guid of a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
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...
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.