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

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

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 3379
dima69
181 Expert 100+
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
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!AlertPersonnelSubFRM.Requery put me in infinite loop. (In on current event of AlertPersonnelSubFRM)

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 Expert 1GB
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!AlertPersonnelSubFRM.Requery put me in infinite loop. (In on current event of AlertPersonnelSubFRM)

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!YourMainForm!YourSubformControl.Requery

Replace the above with the actual names used in your application.
Jul 24 '07 #4
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(checkbox).

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 Expert 1GB
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(checkbox).

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
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
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
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...
5
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...
15
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...
13
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...
1
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....
1
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...
2
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...
15
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...
7
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.