472,783 Members | 1,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 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 3331
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 2000I 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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.