If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Sub-Form data entry
If you have created a mainform record, it is saved the moment you focus on
the subform. If you are not focusing on the subform first, you must explicitly save the mainform's record before moving to the "Data Entry Form" You can do that in the button which opens the data entry form. Also, by using a default value in the foreign key field of the "Data Entry Form", which refers to the primary key in the main form, you can assure that field will be properly filled. It is imperative, however, that the main form be open, or you'll be prompted for the value. Set the foreign key field's textbox's DefaultValue to something like: =Forms!MainFormName!PrimaryKeyTextboxName -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "John S" wrote in message ... Arvin, You may have misunderstood what I am trying to do. If you enter a new record direct into a sub-form control then the 'one' side of the relationship is automatically updated. When using a seperate Data Entry Form (bound to the sub-form's table) MS Access doesn't know that the 'one' side needs to be updated. Presumably because there is no Link Child Fields and Link Master Fields properties on the Data Entry Form. In short, I need to tell the Data Entry Form to relate to the current main form record. Does anyone know how? Regards, John. "Arvin Meyer [MVP]" wrote: "John S" wrote in message news Jeff, Sorry - yes - the sub-form is the many side of a one-to-many relationship. You've hit the nail on the head! Is there an easy way to update the 'one' side field (ie main form/table) from my Data Entry form? If the data entry form is bound to the subform's table, as is the usual case, the answer is no. Why would you want to enter data on the many-side without a one-side record? That's like a doctor creating an operation when he hasn't contacted the patient yet. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com . |
#22
|
|||
|
|||
Sub-Form data entry
Arvin,
Many thanks. I had overlooked the DefaultValue. All now works fine. Regards, John. "Arvin Meyer [MVP]" wrote: If you have created a mainform record, it is saved the moment you focus on the subform. If you are not focusing on the subform first, you must explicitly save the mainform's record before moving to the "Data Entry Form" You can do that in the button which opens the data entry form. Also, by using a default value in the foreign key field of the "Data Entry Form", which refers to the primary key in the main form, you can assure that field will be properly filled. It is imperative, however, that the main form be open, or you'll be prompted for the value. Set the foreign key field's textbox's DefaultValue to something like: =Forms!MainFormName!PrimaryKeyTextboxName -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "John S" wrote in message ... Arvin, You may have misunderstood what I am trying to do. If you enter a new record direct into a sub-form control then the 'one' side of the relationship is automatically updated. When using a seperate Data Entry Form (bound to the sub-form's table) MS Access doesn't know that the 'one' side needs to be updated. Presumably because there is no Link Child Fields and Link Master Fields properties on the Data Entry Form. In short, I need to tell the Data Entry Form to relate to the current main form record. Does anyone know how? Regards, John. "Arvin Meyer [MVP]" wrote: "John S" wrote in message news Jeff, Sorry - yes - the sub-form is the many side of a one-to-many relationship. You've hit the nail on the head! Is there an easy way to update the 'one' side field (ie main form/table) from my Data Entry form? If the data entry form is bound to the subform's table, as is the usual case, the answer is no. Why would you want to enter data on the many-side without a one-side record? That's like a doctor creating an operation when he hasn't contacted the patient yet. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com . . |
Thread Tools | |
Display Modes | |
|
|