Subform data disappears on refreshing main form

Mr_Si

Registered User.
Local time
Today, 16:17
Joined
Dec 8, 2007
Messages
163
Hi all,

In my database, HERE, - as corrected by missinglinq, it is 2007 version

When the main form refreshes, (or the first page) the subforms lose all the data from their controls and it's killing me!

I've just been trying the db out and it must not be referencing the data properly.

I don't understand it!!!!

Please can someone help? The main form, btw, is frmEnquiry

I look forward to replies.

Your recent newbie,
Simon
 
Last edited:
When posting questions concerning version 2007 please note this fact in your thread. People trying to help you by downloading your file are wasting their time if they aren't running 2007, and so many things are handled differently by this version that it's frequently essential to have this info.
 
I apologise, I meant to do that.

Thank you for correcting me.

Yes, it is Access 2007
 
I get missing library problems. When I correct them, I don't understand what you think it wrong. Can you walk me through the problem in detail using data in the file?
 
Which missing libraries?

Basically, for example, I click NEW ENQUIRY on the switchboard and it opens frmEnquiry ready to enter new data:

frmEnquiry_GeneralPage.jpg


I enter data in the form controls on the general page, then the contact page, then the site page, then the quote page and then the associated documents page:

frmEnquiry_GeneralPage_dataEntered.jpg



frmEnquiry_ClientPage_dataEntered.jpg



frmEnquiry_sitePage_dataEntered.jpg



frmEnquiry_quotePage_dataEntered.jpg



frmEnquiry_AssocDocsPage_dataEntere.jpg


On going back to the general page and clicking on the area by the Enquiry Date and Live Project Check box etc, or if hitting F5 or refreshing frmEnquiry when on any page, the data that was showing in the visit date datasheet (which is a subform of a subform), the client details subform and the site details subform all disappears as follows:

frmEnquiry_GeneralPage_afterrefresh.jpg



frmEnquiry_ClientPage_afterrefresh.jpg



frmEnquiry_sitePage_afterrefresh.jpg



The data in the other forms stays. It's bizarre, as all the Link Master and Link Child entries point to the Enquiry_ID by the relationships.
This is the oddest thing ever and I can't understand why.

I hope the above gave some sort of idea as to what I'm getting
 
if you have a main form/sub form, and you have an entry in main form for which there is no subform data (eg a New entry in the main form)

then

if the subform doesnt allow new items, or is based on a non-updateable record set, there is no data to show in the subform, and the subform will appear blank

trying to reference any subforms controls will throw an unusual error message,

I would check whether this is causing the problem
 
Sorry to appear very dumb, but how would I find that out?
I can't find an obvious entry in the property fields which give me that information.
 
i don't know if this is the issue,

try opening the subform query directly, and see if it lets you change data/add new data

look at the main form/ subform data properties to see if allow additions is true or false etc
 
Is the Data Entry property set to YES instead of NO? If so, a requery would make things disappear.
 
Ah, I think it is. I shall go check.

If it is yes, and I change it to no,

When I open the form for a "New Enquiry", I take it I wouldn't be able to enter data into a subform such as frmContacts.
Would I need to bring up, say, a clone form eg. "frmAddContactDetails" to input the data, then close it, and have the data just entered via the clone form "frmAddContactDetails" be displayed into the subform "frmContacts"?

OR

Would it be fine and I could enter info straight in?
 
Hmmmm, on looking, I see that they're set to "no".
 
I am unable to get your forms to work at all but I did go through them in design mode and verify that Data Entry is set to "No" for all forms/subforms.

I get a missing library (srch.dll I believe).

Anyhow, I tracked your problem down to your menu:
Code:
Private Sub btnSwitchNewEnquiry_Click()
    DoCmd.OpenForm "frmEnquiry", acNormal, , , [B][COLOR=red]acFormAdd[/COLOR][/B]
End Sub

In Access 2007 Help:
AcFormOpenDataMode
EnumerationSpecifies the data entry mode of a form.

Name Value Description
acFormAdd 0 The user can add new records but can't edit existing records.

So you need to re-think what option you want to open that form with. Once a form loses focus (as in when a sub-form takes focus), the data in that form is saved and the row is no longer a new row. That's why your data disappears.
 
Hmmmm, I wonder if it's possible to remove that option altogether...

I shall try tomorrow - I'll log in remotely and give it a go.

Thanks. :)

Edit: AcFormEdit seems appropriate if not, me thinks.
 
Hmmm, just tried it and the same is still happening. :(

Maybe I'll try and add a subform again with the wizard, but create a new one using an existing table rather than an existing form. I shall post back with the results.
 

Users who are viewing this thread

Back
Top Bottom