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

Delete Records In Subform

27
Could you please advise whether it is possible to delete records in suborm.
When I highlight whole record it won't let me do it.
I've chcecked all properties and it should allow to delete records..
Main form is Purchase Order2 and Subform Name is PO1 Subform,

Thanks
Jul 17 '08 #1
9 24261
mshmyob
904 Expert 512MB
Yes you can. Depends how you have your settings.

If you have the record selector property set to Yes then you can right click on the far left (record selector) and a little menu will pop up to allow you to delete. Of course your allow deletions property must also be set.

Or you can add a button that allows deletions.

cheers,
Jul 17 '08 #2
MEGDZIA
27
Thank you for your help.Unfortunately none of those options works as the subform is a datasheet so no button available and when I click on the record selector the delete option is not available either. I've chcked all the allows and everything should work fine but it's not unfortunately (:O(
Jul 17 '08 #3
missinglinq
3,532 Expert 2GB
Access handles AllowEdits/AllowDeletions/AllowAdditions differently when you're dealing with a form/subform situation.


The first thing you have to understand is that how these properties are set on the form being used as a subform means absolutely nothing! If you run the form independently, they will perform as expected. But if the form is used as a subform, they are completely ignored! The subform "container" is actually a control on the main form, and as such, it is ruled by how these properties are set on the main form.

If AllowDeletions is set to No on the main form, fields cannot be deleted on the main form or on the subform. And to make things really confusing, since the subform is considered to be a control on the main form, if AllowEdits is set to No on the main form, records on the subform cannot be deleted! This is true even if AllowDeletions is set to Yes on the main form ! That's because Access doesn't consider what you're doing as "deleting a record" on the subform, but rather as trying to "edit a field in a record" on the main form!

So, to summarize, to be able to delete a record in a subform, the AllowEdits and the AllowDeletions properties both must be set to Yes on the main form.

If AllowEdits and AllowDeletions are set to Yes on the main form, the next thing to consider is whether or not the main form can be edited. Not all forms can be edited; if a form is based on a non-editable (Read-Only) query, then subform records cannot be deleted, regardless of how the mentioned properties are set on either form or subform. Allen Browne has a short article that explains why some queries are read-only:

http://allenbrowne.com/ser-61.html


Linq ;0)>
Jul 17 '08 #4
MEGDZIA
27
I have checked everything as per your directions and still cannot delete an record...don't really know what else it can be:o(
Jul 17 '08 #5
missinglinq
3,532 Expert 2GB
Can you delete a record in the main form?

Linq ;0)>
Jul 17 '08 #6
MEGDZIA
27
yes I can (doing that whole form will be deleted)
Jul 18 '08 #7
mshmyob
904 Expert 512MB
Do you by chance have referential entegrity enforced and your error trapping turned off? If referential entegrity is on then maybe it can't delete because of a referenced value in another linked table.

Just an idea.

cheers,
Jul 18 '08 #8
After many,many hours af research, I have found the answer to this problem.
Here is the setup I have:
Main form (frmCustomers) which displays as a single form. frmCustomers contains a subform(frmCustomersSubform1) which displays as a datasheet. frmCustomersSubform1 contains as subform(frmCustomersSubform2) that also displays as a datasheet. When a user tries to delete from frmCustomersSubform2, it doesn't prompt for delete conformation, but appears too delete. A second attempt causes a conformation prompt and again appears to delete. However when you exit and reenter, the records are still there.

I found that by changing the middle form(frmCustomersSubform1) display from datasheet to single form the problem was solved. However that makes for a ugly setup. Therefore I pull my 3rd subform(frmCustomersSubform2) out and made it a seprate form below my datasheet and added code to populate it from the OnCurrent event in frmCustomersSubform1. This works like a charm. I did not have this problem in 2000-2003 but it sure died in 2007.

Hope this helps someone.
MS
Nov 16 '08 #9
mshmyob
904 Expert 512MB
??????????????????????????

cheers,
Nov 16 '08 #10

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

Similar topics

0
by: Deano | last post by:
If I create 2 or more records in my subform and I then delete the main record, then all the controls on my subform disappear. Yet if there is only one record in the subform then it gets deleted...
4
by: Deano | last post by:
If I create 2 or more records in my subform and I then delete the main record, then all the controls on my subform disappear. Yet if there is only one record in the subform then it gets deleted...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
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...
3
by: Jeff | last post by:
In a subform I have a simple SQL statement that links an order details table to a product table. The form is used to enter order details. Most fields are obviously from the details table, with only...
5
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
3
by: brucedodds | last post by:
My application has a form based on a parent table with a subform based on a child table. The relationship is Cascade Delete. The first record displayed when the form opens has five child records....
10
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I...
31
by: matthewslyman | last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion. My form design involves a recursively...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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...

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.