473,401 Members | 2,127 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,401 software developers and data experts.

Delete a record, but the table hasn't updated yet?

Hi All,
I have a strange situation that I can't figure out. The task is quite simple, delete a record from a table. Here is my situation:

I have a form called Order Create which cycles through the parts in my database, run off of a table called Master BOM. In this form there is a subform called Order Data (not linked to the main form) which has a field on it called OrderID. This subform is run off of a table called Order Data, which has OrderID as the primary key (autonumbered). In this subform is a nested subform called Order Details which shows all of the parts contained in that order. The idea is to sort through the parts in the main form and pick some to add to the order. This all works fine, just thought I would paint the picture.

Here is the problem. When I open up the Order Create form, I have it create a new record in the Order Data table (ie. a new order number via having the Data Entry property set to yes for the Order Data subform). Now, I have a button on the main form called Submit, which closes the main form, then checks to see if the order is empty (this works fine so far), and then if it is empty, it is supposed to delete the new record in the Order Data table. The problem is here, it doesn't delete the record. I have a module to accomplish the task, and the code to find and delete the record WORKS, I know it does because I have tried it in the immediate window it I know it works. For some reason though, the Order Data table hasn't added the new record yet, so my code isn't finding it. Is there some sort of Refresh command I can use? I even had the Order Data table open, then opened the Order Create form, which showed the new OrderID number in the Order Data subform, but yet the new record in the Order Data table had not appeared until I closed the main form, closed the Order Data table, and then re-opened the Order Data table.

What is up with this? I thought the task would be easy, and I certainly wasn't expected to run into this. Help me please!!!
Nov 6 '07 #1
3 2497
Hi All,
I have a strange situation that I can't figure out. The task is quite simple, delete a record from a table. Here is my situation:

I have a form called Order Create which cycles through the parts in my database, run off of a table called Master BOM. In this form there is a subform called Order Data (not linked to the main form) which has a field on it called OrderID. This subform is run off of a table called Order Data, which has OrderID as the primary key (autonumbered). In this subform is a nested subform called Order Details which shows all of the parts contained in that order. The idea is to sort through the parts in the main form and pick some to add to the order. This all works fine, just thought I would paint the picture.

Here is the problem. When I open up the Order Create form, I have it create a new record in the Order Data table (ie. a new order number via having the Data Entry property set to yes for the Order Data subform). Now, I have a button on the main form called Submit, which closes the main form, then checks to see if the order is empty (this works fine so far), and then if it is empty, it is supposed to delete the new record in the Order Data table. The problem is here, it doesn't delete the record. I have a module to accomplish the task, and the code to find and delete the record WORKS, I know it does because I have tried it in the immediate window it I know it works. For some reason though, the Order Data table hasn't added the new record yet, so my code isn't finding it. Is there some sort of Refresh command I can use? I even had the Order Data table open, then opened the Order Create form, which showed the new OrderID number in the Order Data subform, but yet the new record in the Order Data table had not appeared until I closed the main form, closed the Order Data table, and then re-opened the Order Data table.

What is up with this? I thought the task would be easy, and I certainly wasn't expected to run into this. Help me please!!!
After adding the new record in your code, add Me.Requery to display new records, or remove deleted records. Be sure to do it after you delete a record as well.
Nov 6 '07 #2
After adding the new record in your code, add Me.Requery to display new records, or remove deleted records. Be sure to do it after you delete a record as well.
Ok, I think this will work, the only thing is that my Order Data subform goes to the first record after the requery, and I need it to stick on the last. Any suggestions?
Nov 7 '07 #3
Ok, I think this will work, the only thing is that my Order Data subform goes to the first record after the requery, and I need it to stick on the last. Any suggestions?
Never mind! It works just fine now. Thanks :)
Nov 7 '07 #4

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

Similar topics

16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
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...
4
by: Susan Bricker | last post by:
I have a command button on a form that is supposed to Delete the record being displayed. The record is displayed one to a form. The form is not a Pop-Up nor is it Modal. Tracing the btnDelete...
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...
17
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
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...
9
by: =?Utf-8?B?UHJhdmlu?= | last post by:
We are using .net Framework 1.1 We are having one page on which we are using this Grid component. From this page we open a popup for adding new record as well as for editing an existing record...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
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: 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...
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
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...

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.