473,785 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When I create a new record on mainform, Subform ghosts data from previous record

36 New Member
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the mainform. My subform in the detail section goes blank (this is what I want) but my subform in the footer section appears to have the data from the previous record displayed. When you click on the subform the data dissapears and displays blank. If I go back one record on the main form and return to the newly created record then the subform is blank. What I would like is to just have the subform show blank when I create the new main form record.

I am unsure if it has anything to do with it, but I have some code that autofills my main form with data from the previous record, but the subform is not included in that code at all.

If needed I can include a screen shot of what I mean if that will help.

I don't know what I would have done without this forum, you guys ROCK !!!!!
Jul 24 '07 #1
7 3428
dima69
181 Recognized Expert New Member
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the mainform. My subform in the detail section goes blank (this is what I want) but my subform in the footer section appears to have the data from the previous record displayed. When you click on the subform the data dissapears and displays blank. If I go back one record on the main form and return to the newly created record then the subform is blank. What I would like is to just have the subform show blank when I create the new main form record.

I am unsure if it has anything to do with it, but I have some code that autofills my main form with data from the previous record, but the subform is not included in that code at all.

If needed I can include a screen shot of what I mean if that will help.

I don't know what I would have done without this forum, you guys ROCK !!!!!

Have you tried requerying that subform, something like
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Me![SubFRM].Requery
  3. End Sub
Jul 24 '07 #2
FNA access
36 New Member
I tried this, but got error that it could not find the field ( I assume [subFRM] is meant as the name of my subform)

I then tried to use Forms!AlertPers onnelSubFRM.Req uery put me in infinite loop. (In on current event of AlertPersonnelS ubFRM)

I then tried in the on current event of my main form and i still see the display of the information associated to the main forms last record. Again the data is not actuallty there as when you click the subform it returns to an empty datasheetview.

Any other suggestions are welcome

Thanks
Jul 24 '07 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
I tried this, but got error that it could not find the field ( I assume [subFRM] is meant as the name of my subform)

I then tried to use Forms!AlertPers onnelSubFRM.Req uery put me in infinite loop. (In on current event of AlertPersonnelS ubFRM)

I then tried in the on current event of my main form and i still see the display of the information associated to the main forms last record. Again the data is not actuallty there as when you click the subform it returns to an empty datasheetview.

Any other suggestions are welcome

Thanks
Your syntax for the requery appears to be incorrect. It should be:

Forms!YourMainF orm!YourSubform Control.Requery

Replace the above with the actual names used in your application.
Jul 24 '07 #4
FNA access
36 New Member
I am unsure what is meant by subform control. My subform has two fields and is displayed in data sheet view. The two fields are Name (textfield) and Standby(checkbo x).

Do you mean the name of the subform?

Sorry for needing you to supersimplify, i assumed that control was like a textbox etc.

Thanks,

Chris
Jul 24 '07 #5
puppydogbuddy
1,923 Recognized Expert Top Contributor
I am unsure what is meant by subform control. My subform has two fields and is displayed in data sheet view. The two fields are Name (textfield) and Standby(checkbo x).

Do you mean the name of the subform?

Sorry for needing you to supersimplify, i assumed that control was like a textbox etc.

Thanks,

Chris
The subform control is the name of the "container" for the subform on the Main form. The subform is the form inside the container. If you click on the border between the form and subform you will invoke the property sheet for the subform container that holds the subform.. The first property is the subform container control's name property, and the second property listed says Source Object. Source Object is the name of the subform inside the subform container. Frequently, the subform container and the subform itself have the same name,but not always>>>>>and you need the name of the container for your requery..
Jul 24 '07 #6
FNA access
36 New Member
Thanks for the insight. I was unaware that the container even existed. I checked the name and it was different. I still have the subform display data from previous main form record.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Call AutoFillNewRecord(Forms!Alert)
  3.   [Forms]![Alert]![AlertPersonnelSubform].Requery
  4. End Sub
I have taken some screens of the form that depicts what is happening, as well as what I would like to happen. How do I post the images, if you think they might help?

Thanks
Jul 24 '07 #7
FNA access
36 New Member
I got it too work, maybe not the most elegant way, but...

All I did was in the current event of my main form I set the focus to my subform and then back to my main form and voila, no ghosted data.

I don't understand why the ghosted data showed up in the first place, but it is gone now.

Thanks to all who tried to help. It is greatly appreciated.
Jul 24 '07 #8

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

Similar topics

0
1800
by: Arnold | last post by:
Hi there, I have a form to organize bottles in mind, but am unsure if it will work. Here's some background info: Mainform = frmProduct, which contains fields for pricing, status, etc. of complete bottles, as well as an image control for a thumbnail of a complete product (bottle + cap). The mainform has 2 subforms that must be visible and side-by-side:
5
3373
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and floats above (ie is pop-up) ! Private Sub ListBox_DblClick(Cancel As Integer) DoCmd.OpenForm "Forms!!!.Form! = Me!ListBox.Column(1) Forms!!.Form! = Me!ListBox.Column(2)
15
11264
by: Susan Bricker | last post by:
Greetings. I have a Mainform with a subform. The Mainform has single record format and subform has continuous form format. When the Mainform opens, I force allowadditions and allowedits to FALSE (for both the Mainform and Subform). No problem there. However, when I click on the navigation control of the subform to move to the next record in the subform, the AllowAdditions and AllowEdits changes to TRUE. Not good. I set...
13
6787
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after key points such as the store number and the store ID. The fields of those tables are generic fields such as sales per day, bank deposit and what not. The first field for each store table is the date and I've set that as the primary key as one...
1
3072
by: planetthoughtful | last post by:
Hi All, I have a mainform with a subform in which I show some task summary data. On the mainform I have a number of unbound controls that reflect values relevant to each task in the subform. The unbound controls are populated in the subform's OnCurrent even from a number of different tables related to the records in tbl_tasks, which is the recordset displayed in the subform.
1
3237
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working with. If a user enters data in a subform, then directly clicks the command button on the parent form, the data in the subform is not included in their document. I THOUGHT that as soon as focus left the subform, any pending changes to the data...
2
2773
by: angi35 | last post by:
I hope this is an easy question for someone out there. In Access 2000…I have a MainForm with a tab control (MAIN TABS) with 7 tabs. Within each tab is a SubForm. Within each SubForm is a tab control (TabCtl0) with 2-6 tabs. Within each TabCtl0, each tab contains a SubSubForm. Each record in the MainForm has an ID Number; the SubForms are bound to that ID Number, and the SubSubForms are bound to that ID Number in the SubForms. In order...
15
6263
by: postman | last post by:
Any idea why code would work as intended when setting a breakpoint and stepping through it line by line, but won't work correctly at run-time? The code is too much to post, so I hope this summary of the setup will suffice: There are 3 forms: MainForm recordForm (subform on MainForm) dlgForm (pop-up form)
7
9594
reginaldmerritt
by: reginaldmerritt | last post by:
I have a few forms which i have designed to be subforms to a mainform that has no fields or record source. The forms have an unbound textbox and combo box, which i use to seach the data on these 'continuous' forms. Which works fine when i open them as main form. However, as soon as i use them as subforms i can't enter or select anything from the unbound textbox and combo box on the subform. I have checked both the mainform, subform and...
0
9643
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, 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...
0
10319
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, 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...
0
10147
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 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...
0
9947
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 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...
0
8971
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, 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...
0
6737
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();...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.