Solved

How do I auto-save a subform?

Posted on 2006-10-30
17
295 Views
Last Modified: 2013-12-18
I have a form with several subforms.  The pop-up subforms are opened via action buttons on the form.  The subforms contain both computed and data entry fields. Thanks to several experts on this board I have almost everything working great!  

However, when I open a subform and enter data into the text fields, close the subform and then re-open it, the data is not retained.  Is there a command I can use in the subform to auto-save it before closing?

Thanks in advance!  (500 pts. for this... I'm in a rush to get this database completed!)
0
Comment
Question by:justkrissy
  • 6
  • 5
  • 3
  • +1
17 Comments
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 210 total points
ID: 17837384
Normally, subforms autosave, unless
- you used the wrong fieldnames on the underlying form,
- you recompute the fields on the underlying form before you reopen the dialogbox,
- you have the option NoNewFields selected
- there must be more...
0
 

Author Comment

by:justkrissy
ID: 17837484
- you used the wrong fieldnames on the underlying form,
**I double-checked...everything seems to be correct
 
- you recompute the fields on the underlying form before you reopen the dialogbox,
**How do I check to see if I'm doing this?

- you have the option NoNewFields selected
**My formula looks like this:
    @DialogBox("subform" ; [AutoHorzFit] : [AutoVertFit] : [NoCancel] :[SizeToTable] : [NoOkCancel] : [OkCancelAtBottom] ; "title" )

Is there another place to check to make sure NoNewFields is not selected?

- there must be more...
**Yeah?
0
 
LVL 63

Assisted Solution

by:SysExpert
SysExpert earned 210 total points
ID: 17837544
SUbforms should be saved with the form, so make sure that you save the form when closing a subform.

I hope this helps !
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:justkrissy
ID: 17837674
The form remains open in the background when the subform is opened.  The computed fields on the subform are working properly.  When I type in the text fields on the subform, it takes the text.  I close the subform and the form is, of course, still displayed.  I have tried manually saving at this point, then going back into the subform... the data is not there.  I'm not sure when or how I should save the form in order to save the subform.

Confused yet?  I am!
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17837870
Are you sure that you are not setting te field defaults to something that cleans out the filed when opened.

Defaults for editable fields should probably be the field name itself, not something like ""

I hope this helps !
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17837983
As far as I can see, the method you're using is absolutely correct: a document in a form, and then you call Dialog Box with a subfrom. The same fields on the form are the same fields on the subform. So far so good.

Does it happen for ALL fields, that they revert to the previous value? If not, can you find out what's the difference between the calculations for those fields?

What's the type of the same text fields on the main form? How are they computed? If they are computed, and they'd better be, the best would be to compute those fields with
    @ThisValue
If they need an initial value, use
    @If(@IsDocBeingLoaded; "initial value"; @ThisValue)
0
 

Author Comment

by:justkrissy
ID: 17843200
Not ALL of the fields on the subform as the same as those on the form.  Right now, until I get this figured out, I have six fields on the subform.  The first three are computed fields that pull from the form.  Those three are working just fine.

The last three fields on the subform are EDITABLE text fields.  So the user can type free text into those fields.  When I type text in them, my text appears in the field and everything looks fine.  I close the subform and reopen it, and the editable text fields are again blank.  The computed fields are still displaying properly.  

I just can't get the editable fields to retain the data that I enter once the subform is closed.

Make sense?
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17844389
Please read my previous comment about initial default values for your editable fields.

I hope this helps !
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17845874
As SysExpert says, if you have field ABCD in the form and the subform, the editable field in the subform should have the default value formula set to ABCD as well.
0
 
LVL 8

Accepted Solution

by:
behenderson earned 80 total points
ID: 17847834
From sjef

Normally, subforms autosave, unless
- you used the wrong fieldnames on the underlying form,
- you recompute the fields on the underlying form before you reopen the dialogbox,
- you have the option NoNewFields selected
- there must be more...

What you should get from this is that in order for the subform to save the values between uses the fieldname has to be on the underlying form AND the field in the subform and form cannot have any Input Traslation etc.. that will cause the field to have a different value.  If I read your response correctly only 3 of the fields are on the underlying form which is bad news because only those 3 fields will be retained.  In order for fields to be passed from the Form to the subform and vice versa the fields need to be on both.  Which was basically answered in the first response by sjef.
0
 

Author Comment

by:justkrissy
ID: 17860911
Okay... now I think I get it.

Any fields that I want to be on the subform MUST also be on the original form.  Perhaps, then, subforms are not what I should be using.

For example, if I have a form that has 10 fields on it and only want 4 of those fields to display in a pop-up window... and have other fields that are not on the original form... how can I do this?  By using another form for the pop-up rather than using subforms?

Any suggestions?
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17860997
Yes, just use another form.

It also depends on what your goal is  with the second form.

Are you transferring data from one to anohter ?

In which direction.

Is the form retained or temporary ?

I hope this helps !


0
 

Author Comment

by:justkrissy
ID: 17874982
I would be transferring some data from the main form to the pop-up form.  The pop-up form would also have data fields that are not on the main form.

The pop-up form data would need to be retained.  As well as the data on the main form.  So it sounds like a pop-up form may work for me.

(Any suggestions before I start on how I need to set up the pop-up form to retain the data... both the transferred data from the main form as well as the data-entry fields that are only on the pop-up form.)

I'll give it a try and let you know how it works.

Thanks so much for all of your help!

0
 

Author Comment

by:justkrissy
ID: 17878736
I finally figured it out!

I used the following for my pop-up subforms:
@DialogBox("form" ; [AutoHorzFit] : [AutoVertFit] : [SizeToTable] ; "title" )

By omitting [NoCancel], [NoOkCancel] and [OkCancelAtBottom] from the above command, the subforms retain all data when I click the "OK" button.

I split the points between sjef_bosman, SysExpert and behenderson (although I accidentally selected the wrong comment as the "accepted answer".)

Thank you all so much for your help!
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17878760
DO you need to create views with data from both forms, or just from one form ?

DO you have all the keys in both forms for views or are they somehow related ?

Are you using any kind of response docs ?

0
 
LVL 8

Expert Comment

by:behenderson
ID: 17890653
justkrissy,

Just a comment to round out the thread.. I am glad that you got it to work without putting the fields on the form.  I am not sure that there is really as big a difference in doing that as you would like.  If you look at the documents properties after you save it I am sure that those field values have been saved in the document.  So even though there is not a field for them on the form they are still there in the document.  In terms of saving space on the UNK and having streamlined forms there is no real difference between them being on the form or not.  

The Efficient way of doing this is to have the fields on the form that you not want them saved on(the main form,) but have them on that form as Computed for Display.  That way they are not actually saved when your document is saved.  This is vastly more efficient.  It does not take up any UNK space since UNK space is on unique field names regardless of how many forms they are on, and more importantly it does not take up any space in the document.  Not taking up space in the document makes the database more efficient.
0
 
LVL 8

Expert Comment

by:behenderson
ID: 17890697
Final thoght

A dialog box is not a different document, a DialogBox is just another way to display a document.  So when you use a dialog box you are just showing different inputs that go to the same underlying document.  That is the technical deffinition of what a dialogbox is.  When you use a dialog box you just get a little more control over the input, and if there are a lot of dbLookups on the dialogbox you add a great deal of efficiency to the form opening and closing in a reasonable amount of time in read mode.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HP DP 7.03 and lotus collaboration suite 9 3 162
IBM Lotus Notes Rules not working 5 233
Code for extraction to mkdir folder 5 72
DNS error assumed 8 71
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question