Full Version: Form/Subform Question
UtterAccess Forums > Microsoft® Access > Access Forms
I have a form and a subform within the form. Three of the fields in the form are linked to the first three fields in the subform. Thus, when entries are made in the first three fields these same fields in the subform are updated. Then in the subform there are four additional fields. The problem I am having is after I make an entry in the first of the four unlinked fields in the subform, the form automatically drops another row below with the three linked fields & then I have to tab through that row to update the records. So, I end up with one row of data that only has data in three fields.
Is there some way to work around this to where the 2nd row of linked data does not drop down and populate until I actually tab down to the row? And, if I only update the first row, can I just create a macro or something to update all of the data from the subform into the table?
Any help would be greatly appreciated!
Steve Blend
change the CYCLE property for the form to "Current Record"
lso, check the Tab Order
right-click in detail section and choose Tab Order
As discussed in your previous thread, you are using the fields on the main form to avoid duplicate keying for these three fields.

THere are some things to consider.

1. The three fields on the main form are, or should be unbound. That is, they are not linked to the table themselves. They only serve as "templates" for the corresponding controls in the subform.
2. The corresponding fields in the subform have their default values set to these three controls. That means you do not have to enter values into the controls when creating a new record.
3. The sub-form DISPLAYS these default values for a POTENTIAL new record even though that new record is not actually created until the user does something with that record. That is why you see them "drop" to the next row when you enter the values in the first row of the subform. They are only POTENTIAL values for that second record. If you don't tab into that row, it should not actually create and save the record.
4. You can control the tab key so that it cycles within a single record, avoiding the accidental tabbing into the POTENTIAL new record. Like Crystal said. LOL


Edited by: GroverParkGeorge on Fri Jan 13 1:25:42 EST 2006.
I tried the setting to cycle "Current Record". However, even if I do not tab down to that row and click on the "Add A New Record" button which I created, the information in the row below is still showing up in the table.
lso, for the unbound controls, how do you call them from the default value of the fields in the subform?
The problem with two of the fields I have at the top is they are combo boxes so it is hard for them to "not" be bound to something.
For combo boxes and list boxes having a RowSource is not the same thing as having a ControlSource. "Bound" only applies to the ControlSource Property. It does not apply to the RowSource property.

HAs you probably know, when we talk about unbound control--whether text field, combo or list box, or one of the other types of controls--we mean that the ControlSource property of that control is not bound, or connected to, any field in any table.

Combo and list boxes also have a RowSource property. The RowSource can be a value list, a table or query, or a field list. What that means is that the CHOICE of values from which you select in the list or combo box is supplied by the rowsource. The only analogy I can come up with at the moment is that the values offered to you in a combo box are somewhat similar to a fan of playing cards which a magician holds out to you, saying "pick a card, any card." Until you actually reach out and pull one of the cards from his hand, it is not "bound" to you for that card trick, it is only a potential choice.

Back to your main problem here.

Actually, the main form itself need not even be bound to a table to make this work. The main form's only function is to provide a handy place to park your default choices, using the three combo boxes. These combo boxes are not bound to any field either. They are merely the parking spots for values you want to use repeatedly in the subform.

Now, in the subform, you have three text boxes. These controls ARE bound to the appropriate fields in the underlying table. Each of these controls has a Default Value property.

Ocreated a small demo to show how it could work. Note that I had to use the After Update Event of the combo box on the main form to get it to work correctly in setting and re-setting the default value of the control in the subform.

Now, each time you start a new record, these three values will be pulled down from the main form. However, Access will OFFER them in a POTENTIAL new values, as you've seen, in the next row down. If you do not start that record either by tabbing into it or clicking on an Add Record button, that record will remain POTENTIAL.


Edited by: GroverParkGeorge on Sat Jan 14 0:28:39 EST 2006.
Thanks for the feedback! I am going to download this attachment and try to figure out how to do this.
I have tried to figure out the example but I guess I just don't understand how to apply it to my form. I tried following the same format but it just doesn't work. The form as I am using it now is not even working properly. I have streamlined the top two fields of the form to only "Date" and "Employee". Shift is just automatic default in the subform for the shift we are on. Problem is, when I select the date and employee then tab to the subform, it only populates the date and employee field on the 2nd row of the subform while my tab goes straight to the function field in the first row of the subform. I then have to move the focus to the function field of the 2nd row since that row has all of the fields populated.
What do you see in that first row? Anything at all? The fact that the defaults are in the second row means the first row is a record from the table with, apparently, empty fields.
All you need to do is select the values in your combo boxes, then tab into the subform. You don't need to do anything else. I suspect that somehow you are adding an empty record.
Can you compress your database into a ZIP file and post it?
I'll return your database later.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.