473,836 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting selected records in subform (query)

21 New Member
Good day sir
Please I have a subform composed of 3 tables merged together to form a query to develop the subform.
Please how do I delete record from this subform?
As I delete, I want the remaining records updated immediately
Thanks sir
Mar 15 '12
22 12537
32,584 Recognized Expert Moderator MVP
Something is not right here Damola. I don't know what you're doing wrong, but certainly something.
  1. How many records show on the subform when it's full?
  2. How many copies of this button are shown?
  3. What has Cascade-Delete got to do with this question? You haven't said anything to lead me to believe it should be involved.

Perhaps it would be a good idea at this stage to indicate what data you're dealing with on the main form and the sub form and how they are related. It's hard to work with so little information, especially when some of it appears to be inaccurate.
Mar 16 '12 #11
21 New Member
Thanks sir for the reply
Actually it is an order details form that has a subform in it.
The order details form is composed of 3tables(custome rs,orders,order s status).
On the subform is composed of 3 tables(drugs,or der details,order details status).
On My main form I have
.The customer's name
.The address
.Employee's name

On the Subform I have
.Item ID which is a combo box
.The quantity the customer wants to buy
.The selling price
.Total price

Thank you sir for the help
Mar 16 '12 #12
32,584 Recognized Expert Moderator MVP
Actually it is an order details form that has a subform in it.
That doesn't seem right, and the rest of your post confirms it. You have an Orders main form with an Order Details subform right? Remember, I only have what you post to work with, so if you post things which are wrong then it will be very hard to help you.

Now, please do all of the following things before I can help you further :
  1. Go back to post #11 and answer both of the first two points which are simple questions.
  2. On the same post, respond to point #3 and explain why you included Cascade Delete as part of the discussion, or confirm that it is irrelevant and I can simply ignore all references to it.
  3. Confirm that my initial statement in this post is correct and we are actually dealing with something that makes sense.
Mar 16 '12 #13
21 New Member
Thank you sir for your reply
I just added the cascade on delete it is not relevant, I thought it will help.
I have one delete button on the mainform (order details)
I also have one delete button on the subform to delete record on the subform.
Yes what you posted is correct.
Thank you sir
Mar 16 '12 #14
32,584 Recognized Expert Moderator MVP
I just added the cascade on delete it is not relevant, I thought it will help.
That's fine, as long as you make that clear. It could have been useful, but in this case it wasn't.

1. How many records show on the subform when it's full?
This question has still not been answered.

I have one delete button on the mainform (order details)
I don't see any relevance to this info. It was not requested.

I also have one delete button on the subform to delete record on the subform.
Please explain which Section this control is found in?

Yes what you posted is correct.
Good. Please pay more attention in future. Posting incorrect information and failing to answer questions that have been asked wastes both your time and mine. It is very important that you ensure you don't continue in this manner if you hope to get answers to your questions. None of us is stupid and we recognise when a poster has wasted our time before, so are less likely to look at their threads in future. It's only common-sense really.
Mar 16 '12 #15
21 New Member
Thank you sir for the replies and your time.
The subform can take 30 records but what I need is just to be able to delete one or two records from the subform.
I placed the delete button in the detail part of the form. The subform is a continuos form and when I change it into a form view all the records have the delete button on each row.
Thank you sir
Mar 16 '12 #16
32,584 Recognized Expert Moderator MVP
OK. So we have a button on the form which is in the subform, and you have the code I suggested in post #8 in the module of that same form (The form in the subform and not the main form itself.), I can only guess, if this is not working for you, that the OnClick property of the CommandButton called BtnDelete still needs to be set to the string "[Event Procedure]".

Please check that. If that's fixed then you need to explain what is happening. Are there errors reported? If so what?

NB. Ensure the project is compiled before responding next. Before Posting (VBA or SQL) Code might help with that.
Mar 17 '12 #17
21 New Member
Thank you sir for the reply
I placed the vba code in #8 in the click event on the form in the subform.
When I press on delete it tells me you are about to delete 1 record(s) I click on yes it removes it from the form.
When I checked the items remaining it didn't add the items deleted back into the inventory.
Let me give an eaxample sir
After ordering for some items and the customer says he doesn't need them anymore deleting didn't reflect addition of the items back into the inventory sir.
Thank you sir
Mar 19 '12 #18
32,584 Recognized Expert Moderator MVP
Please reread my last post. Your post doesn't seem to be a response. You cannot add VBA code to an OnClick event property (which is a string value that points to the name of a macro or the value "[Event Procedure]").

Please try to respond to posts in a way that makes it clear you have actually read them.
Mar 19 '12 #19
21 New Member
Am sorry for the wrong use of words what I meant is that I
created a Command Button control on that form and placed the code in #8 in the Click event procedure for the Command Button.
When I press delete it tells me that you are about to delete a record, I deleted the record but it doesn't update my records.
Thank you sir.
Mar 19 '12 #20

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

Similar topics

by: abcd | last post by:
I wish to make in query or report, different row widths for "only the selected records". i.e. I wish the entry is folded into two or more lines whenever it exceeds the field size. Any clue to this much appreciated. Thanks. -abc
by: DD | last post by:
I have a mainform with a subform. > The main form has a dropdown box "chooseMonth", in the afterupdate event > i requery the subform so all records with the same date are viewed. > Now i only want to print the selected records of the selected month > Can any one advise on the below Below is code i am trying to adapt (Thanks Don) 1.This first part is causing me problems so i have deleted it as it strikes me that it is looking for a...
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only displays the records associated with that ProductID. Basically this is part of a Product Packing Pick System. From my products table, each product has a set default amount of items which
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
by: indrag91 | last post by:
hai, i am using access database. Iam selecting few records based on a condition. For e:g select * from stud where avg>90 and placing these records in a multiselect list box. for e:g if there 10 records and i want to print any two selected records from the list box in the data report. How is it possible? Please help. thanks indra.
by: Michael R | last post by:
Hello to all. In what way can I update a certain selected records' values on a datasheet subform using a command button which is located on the main form? Thanks and cheers.
by: =?Utf-8?B?bWFyeGk=?= | last post by:
Now I need to lock the selected records for some time and others can not update these records meanwhile. How can I do? any help will be very appreciated!! -- marxi
by: Toral Shah | last post by:
hello all!!!! i have a program of voucher entry.... there are many records in the table Payment and voc_no is a primary key and auto numbered... now i want only selected records to appear in my report.... like voc_no 1,4,6 on one day or 7,8,11 on the other.... how should i do that....plz help me out with my query
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
by: eneyardi | last post by:
How to filter selected records in a report? for example: i have a form name ADM List, the default view is split form so that i can view all the records. my report name is ADM Report. in ADM List i have a field names; subject and status. in a status field, i have a records of two pending and done (i have two option to put in a status field that is pending and done) for example that i want to filter the status field to done so that all records...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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...
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...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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...
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.