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 |
#1
|
|||
|
|||
Form/Subform
I have a form and a subform. In the form you enter a customer's name and the
model to base their account off of. The subform then displays the eight product categories, their normal amount and has an entry field for their customized amount. I want the user to type the customer's name and the model in the form and automatically have the subform appear with the eight product categories and their normal amounts with the entry field blank. I've tried doing this but when I create a new customer (still using the same 9 models) the subform doesn't appear. What am I doing wrong? |
#2
|
|||
|
|||
Form/Subform
Awach,
The subform is meant to enter records into a detail table. After entering the main form record, no detail records yet exist. If you'd like to base them off a default configuration, perform an Insert query. A convenient place to do this is on a command button that the user presses to complete the main form record. You could attempt to move the focus to the subform, which will trigger the main form's BeforeUpdate event, in which you can verify that all fields have data in them, etc. Then insert the records from some default table into your detail table, and requery the subform. Dim strSQL as String Dim db as DAO.Database ' Move cursor to 1st control in subform, triggering main form B4Update event Me![MySubform].SetFocus Me![MySubform].Form![YourFirstSubformControl].SetFocus ' Set SQL string variable and execute query strSQL = " ... Your insert query SQL ..." db.Execute strSQL, dbFailOnError Me![MySubform].Requery Hope that helps. Sprinks "awach" wrote: I have a form and a subform. In the form you enter a customer's name and the model to base their account off of. The subform then displays the eight product categories, their normal amount and has an entry field for their customized amount. I want the user to type the customer's name and the model in the form and automatically have the subform appear with the eight product categories and their normal amounts with the entry field blank. I've tried doing this but when I create a new customer (still using the same 9 models) the subform doesn't appear. What am I doing wrong? |
#3
|
|||
|
|||
Form/Subform
I get what you are saying about using the subform to enter new data. And I
am entered new data-the customized amount-but the user needs to see the class and the normal amount in order to know what to enter into that field. I don't know that I am fully following what you are saying about the insert query (in fact, I can't even find an insert query) but I'm pretty sure that's not really what I'm looking for. Is there anything else I can do? "Sprinks" wrote: Awach, The subform is meant to enter records into a detail table. After entering the main form record, no detail records yet exist. If you'd like to base them off a default configuration, perform an Insert query. A convenient place to do this is on a command button that the user presses to complete the main form record. You could attempt to move the focus to the subform, which will trigger the main form's BeforeUpdate event, in which you can verify that all fields have data in them, etc. Then insert the records from some default table into your detail table, and requery the subform. Dim strSQL as String Dim db as DAO.Database ' Move cursor to 1st control in subform, triggering main form B4Update event Me![MySubform].SetFocus Me![MySubform].Form![YourFirstSubformControl].SetFocus ' Set SQL string variable and execute query strSQL = " ... Your insert query SQL ..." db.Execute strSQL, dbFailOnError Me![MySubform].Requery Hope that helps. Sprinks "awach" wrote: I have a form and a subform. In the form you enter a customer's name and the model to base their account off of. The subform then displays the eight product categories, their normal amount and has an entry field for their customized amount. I want the user to type the customer's name and the model in the form and automatically have the subform appear with the eight product categories and their normal amounts with the entry field blank. I've tried doing this but when I create a new customer (still using the same 9 models) the subform doesn't appear. What am I doing wrong? |
#4
|
|||
|
|||
Form/Subform
Awach,
I may misunderstand your table structures. It would be helpful if you'd post them. I was presuming that the table underlying your subform is the many side of a one-to-many relationship, linked by the in which case each product category would represent a record in the detail table. Since these records don't initially exist, you would have to add them manually, or insert these records from some ProductCategory master table that stores the normal amounts you wish as the default. If, on the other hand, these product categories are simply fields in the same table as underlies the main form, you don't need a subform--just place the fields on your main form, and assign a DefaultValue to them. What Access calls an "Append" query is an INSERT query in SQL. Sprinks "awach" wrote: I get what you are saying about using the subform to enter new data. And I am entered new data-the customized amount-but the user needs to see the class and the normal amount in order to know what to enter into that field. I don't know that I am fully following what you are saying about the insert query (in fact, I can't even find an insert query) but I'm pretty sure that's not really what I'm looking for. Is there anything else I can do? "Sprinks" wrote: Awach, The subform is meant to enter records into a detail table. After entering the main form record, no detail records yet exist. If you'd like to base them off a default configuration, perform an Insert query. A convenient place to do this is on a command button that the user presses to complete the main form record. You could attempt to move the focus to the subform, which will trigger the main form's BeforeUpdate event, in which you can verify that all fields have data in them, etc. Then insert the records from some default table into your detail table, and requery the subform. Dim strSQL as String Dim db as DAO.Database ' Move cursor to 1st control in subform, triggering main form B4Update event Me![MySubform].SetFocus Me![MySubform].Form![YourFirstSubformControl].SetFocus ' Set SQL string variable and execute query strSQL = " ... Your insert query SQL ..." db.Execute strSQL, dbFailOnError Me![MySubform].Requery Hope that helps. Sprinks "awach" wrote: I have a form and a subform. In the form you enter a customer's name and the model to base their account off of. The subform then displays the eight product categories, their normal amount and has an entry field for their customized amount. I want the user to type the customer's name and the model in the form and automatically have the subform appear with the eight product categories and their normal amounts with the entry field blank. I've tried doing this but when I create a new customer (still using the same 9 models) the subform doesn't appear. What am I doing wrong? |
#5
|
|||
|
|||
Form/Subform
TableA:
Customer Model A 1 B 1 c 2 d 1 .... TableB: Model Type Amount 1 retail 15 1 whoelsael 12 1 other 10 2 retail 7 2 whole 8 ..... TableC: Customer Type CustomAmount ModelName (I d/n know if I necessarily need this) ...... The form is based on table A. The subform would be based on table B and C. I would want the subform to automatically bring up the model amounts from table B because they are the same for every customer with that specific model. Then I want there to be a blank for where the user can enter the customer's custom amount. So, the query isn't based on a one-to-many realtionship...and I don't know how to make it work. Any ideas will be great! Thank you so much! "Sprinks" wrote: Awach, I may misunderstand your table structures. It would be helpful if you'd post them. I was presuming that the table underlying your subform is the many side of a one-to-many relationship, linked by the in which case each product category would represent a record in the detail table. Since these records don't initially exist, you would have to add them manually, or insert these records from some ProductCategory master table that stores the normal amounts you wish as the default. If, on the other hand, these product categories are simply fields in the same table as underlies the main form, you don't need a subform--just place the fields on your main form, and assign a DefaultValue to them. What Access calls an "Append" query is an INSERT query in SQL. Sprinks "awach" wrote: I get what you are saying about using the subform to enter new data. And I am entered new data-the customized amount-but the user needs to see the class and the normal amount in order to know what to enter into that field. I don't know that I am fully following what you are saying about the insert query (in fact, I can't even find an insert query) but I'm pretty sure that's not really what I'm looking for. Is there anything else I can do? "Sprinks" wrote: Awach, The subform is meant to enter records into a detail table. After entering the main form record, no detail records yet exist. If you'd like to base them off a default configuration, perform an Insert query. A convenient place to do this is on a command button that the user presses to complete the main form record. You could attempt to move the focus to the subform, which will trigger the main form's BeforeUpdate event, in which you can verify that all fields have data in them, etc. Then insert the records from some default table into your detail table, and requery the subform. Dim strSQL as String Dim db as DAO.Database ' Move cursor to 1st control in subform, triggering main form B4Update event Me![MySubform].SetFocus Me![MySubform].Form![YourFirstSubformControl].SetFocus ' Set SQL string variable and execute query strSQL = " ... Your insert query SQL ..." db.Execute strSQL, dbFailOnError Me![MySubform].Requery Hope that helps. Sprinks "awach" wrote: I have a form and a subform. In the form you enter a customer's name and the model to base their account off of. The subform then displays the eight product categories, their normal amount and has an entry field for their customized amount. I want the user to type the customer's name and the model in the form and automatically have the subform appear with the eight product categories and their normal amounts with the entry field blank. I've tried doing this but when I create a new customer (still using the same 9 models) the subform doesn't appear. What am I doing wrong? |
Thread Tools | |
Display Modes | |
|
|