Do Not save Subform if they press close (1 Viewer)

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
Hi all. So I have a main form that has the command button "Add Record" and once clicked, a subform pops up (we will name this ClientSubform). On this form, there is a field to enter client name (The only field on ClientSubform). Below that, I have tabbed pages, each containing a new subform (essentially, they are subforms of ClientSubform). I am having 2 issues:

1) I want there to be a command button on the last tabbed page labeled "Save Record". I know this is redundant, but after the user clicks it, I want ClientSubform to close and take me to the main form.

2) If the user closes out of ClientSubform, I want them to be prompted with a message that says something along the lines of - "Do you want to save the changes you made?". I want this to be an option because if the user is filling it out and decides to exit halfway without finishing it, I do not want it to save.

Thanks!
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
So after I fill in that solo field to enter Client Name and then press the close button, the message does show up to prompt me if I want to save it.

HOWEVER, when I fill in that single field in the ClientSubform and instead THEN go on to the tabbed pages to click on a field in a subform IN ClientSubform, the same air message comes up. If I say yes, and continue filling out the other subforms and then decide I do not want to finish and click close, then that prompt fails to come up and all that data that I don't want is stored. How do I go about this?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
THAT becomes a little trickier because just the act of changing the Tabs saves the record. Doing it your way you either need to ask at every Tab or you need code to chaeck the fields on all the Tabs and decide if you want to throw up a message or not. So now I'm questioning is this worth it. A lot of trouble for very little return, why? Why are you locking your Users into an *all or nothing* scenario? Just saying, seems a little harsh...
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
OK I think I will put that question aside for now them. That is just how my form is ans now I am making final adjustments to it. I have another question that you seem very acknoweldge to answer.

So for each client, the first subform on the first page is in a data sheet and they have to put in each of their children's name in the first column, along with their age, school, and grade in the other columns. On the third tabbed page of ClientSubform, I have another subform in a datasheet format where the person now needs to put each child's name in the first column with their allergies, hobbies, and bloodtype in the other columns. Is there anyway that once I put in the childrens' names on the first subform data sheet, that they will autofill on this third subform?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
Umm, bigger concern, why are you filling in this information more than once? It should be once and show everywhere. Now, I'm wondering about your tables. Can you upload a sample file? (Remove all sensitive information, I just need to see the tables.)
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
The thing is I need all my subforms to be in seperate tabled. So Childname, age, school, and grade need to be in one table and childname, allergies, hobbies, and blood type need to be in a seperate table.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
How you display the data is not how you store the data. Data is only stored once but can be displayed a 100 different ways in Forms and Reports. And now I am REALLY concerned based on what you just posted.
 

vbaInet

AWF VIP
Local time
Today, 01:18
Joined
Jan 22, 2010
Messages
26,374
I think ngsabath93 wants to link the subforms together because they are stored in two separate tables. So TableA contains the age, school etc and TableB contains the child's hobbies, allergies etc.
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
OK So my table that my subformclient is based off of has one column - Client Name

I then made different tables to base the other subforms off of and included an extra column titled "Client Name", as well. When I wasin design view on subform client, I used the control/subform wizrd to make each of my additional subforms. And when I was asked, "Would you like to define which fields link your main form to this subform yourself, or choose from the list below?", I chose the first option and for Form/report Field, I put Client Name (from subformclient). And for rhe subform/subreport fields, I put Client Name (from the subform of subformclient).

Does this make sense?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
@vbaInet

That would be my first concern but my real concern is the entering of duplicate data for *each* Tab/Subform.
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
Also, in the relationships, I put seperate joins from Client Name (subformclient) to each of the other tables' Client Name
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
The Client Name on each subform datasheet autofills, so I just have that column hidden on each one. I just wasnt sure how else to link the subform client to all the other forms.
 

vbaInet

AWF VIP
Local time
Today, 01:18
Joined
Jan 22, 2010
Messages
26,374
A child can have multiple allergies and hobbies so it would make sense to have one table for that. A child can also have multiple grades so a separate table is required. What ngsabath93 should be doing is not trying to insert the name of the child but the child ID into the other subform's table and sync both subforms.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
And where is the Child table? That should be linked to the Client table then all the other information in it's own table linked via ChildID. Then you can link via a Junction table and display the Childs name but not have to enter it.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
ngsabath93,

WHat you posted of kind of makes sense, however, I think we are still missing things. Can you post your tables and there fields?
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
I appreciate everything. But I have everything linked by Client Name. What is ChildID?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
The ChildID would be found in the tblChild or is the Client the Child. If so, you would join on ClientID.
 

ngsabath93

Registered User.
Local time
Yesterday, 20:18
Joined
Jun 30, 2014
Messages
48
Should I change the primary key on the design view of each table to "Client Name" on every form?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:18
Joined
Jun 21, 2011
Messages
5,899
You don't change it in the Form only the Tables. That is way I am focused on the Tables.
 

Users who are viewing this thread

Top Bottom