473,412 Members | 3,860 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,412 software developers and data experts.

How to delete a record from two subforms simultaneously?

547 512MB
I have 2 subforms on a form in a tab control that are virtually the same, except the one starts with a code of an item and the other one with a description should you not have a code.
I want to use this code below to delete a record from both subforms at the same time.
How do i amend the code and add the 2nd subform called "Fis_MonthcntSF" to it?

Expand|Select|Wrap|Line Numbers
  1. Private Sub DeleteEntry_Click()
  2. On Error GoTo DeleteEntry_Click_Err
  3. Me.Fis_StocktakeSF.SetFocus
  4. With Me.Fis_StocktakeSF
  5. DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  6. DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
  7. DeleteEntry_Click_Exit:
  8.     Exit Sub
  9.  
  10. DeleteEntry_Click_Err:
  11.     MsgBox Error$
  12.     Resume DeleteEntry_Click_Exit
  13. End With
  14.  
  15. End Sub
pls help
Dec 11 '10 #1
2 2028
Are these two items linked at all by a unique ID?

If so then through the relationships you need to make sure there is a relationship between the two, then click enforce referential integrity and click cascade delete related records.

Save the relationship. Then when you delete one the other should delete
Dec 14 '10 #2
neelsfer
547 512MB
The underlying query is the same, just the layout of the fields are different. i was hoping to add another line to the above code to include this subform where the data must be deleted.
The reason i want to do this, is that you either use the Fis_StocktakeSF or the Fis_MonthcntSF subforms, and not both at the same time.
It depends on whether you want to add the item by its description or by the item code.
You wont lookup the item in both subforms. I want to use this code to delete the last line that you captured in whichever subform you were using. Perhaps the focus should be set on the subform in use ,in this tab control. hope it makes sense!
Dec 14 '10 #3

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

Similar topics

3
by: bher2 | last post by:
please help i was trying to delete a specific record on a table but it still shows the same record that should be deleted. i dont know how.
3
by: Uwe Range | last post by:
Hi to all, I am displaying a list of records in a subform which is embedded in a popup main form (in order to ensure that users close the form when leaving it). It seems to be impossible to...
6
by: Bernd Smits | last post by:
Hi, I would like to delete a record (with commandbutton) of a table associated to a combobox, when I select a certain value in the combobox (the value I select is associated with the record that I...
2
by: bobdydd | last post by:
Hi Everybody I have got a weird one here. I have a large form frmTransactions based on a single table tblTransactions. There are a lot of fields on the form but everything works OK. That is...
3
by: igendreau | last post by:
I'm trying to clean up a database of mine, and I need to convert some old DAO code over to ADO. When I was using DAO, I had no problem running this script and deleting the record using rs.Delete. ...
4
by: Craggy | last post by:
Hi, I am trying to pop up a yes/no message box so that a user can delete a record in a continuous form. The default delete message is a bit sloppy because it seems to move the continuous form to...
3
by: Phil Stanton | last post by:
I have a form based on a complex query (Lots of tables) If I delete a record, everything appears to be OK. Get the message "Youa are about to delete 1 record ....". I say yes. The record count...
4
by: barkarlo | last post by:
I use check box in a form "frmworkorder" like confirmation that's record finish. How can I write code who will block edit and delete record in form when is check box confirmed.
1
by: kimmccain | last post by:
I have a form with two buttons, Completed and Pended. When the completed button is clicked, the record is moved to the completed table and the form's record is decreased by 1. When the pended...
1
by: CreativeMind | last post by:
hi all, private void dgMygrid_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { Button bDelete=(Button)e.Item.FindControl("btnDelete"); if(bDelete!=null) {...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
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...

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.