d_profesor
Registered User.
- Local time
- Tomorrow, 02:18
- Joined
- Jan 17, 2008
- Messages
- 43
Hello, I've some question about form validation.., hope you can help me.
I have form which contain a subform. Main form bound to tbl_Product and subform bound to tbl_Componen_Product. I need to create product number (part number) base on some textbox value from main form and subform..To do this, i create a command button and a new textbox on mainform. I place some vba code in command click event to generate that number and display it in new textbox named txtProductNumber that bound to a field in the tbl_Produk.
My question are quite simple:
1. I want to validate txtProductNumber so that it can't be null. and if user force to close form with empty product number, data won't be saved . Where should i place validation code? I've tried to place it in form beforeupdate, with doCmd.cancelevent method. But it didn't work, because focus has to move to subform when txtProductNumber is still in null value (the value for txtProductNumber generate after some textbox in subform filled. How do i solve it?
2. How do i disable access warning, and replace it with my custom message when a data won't be saved?
2. Is wise to store product number in table for this case? i know that product number can be stored in a query or retrieved with a function when i need it. What is the standard choice, store in table or not?
Thanks
I have form which contain a subform. Main form bound to tbl_Product and subform bound to tbl_Componen_Product. I need to create product number (part number) base on some textbox value from main form and subform..To do this, i create a command button and a new textbox on mainform. I place some vba code in command click event to generate that number and display it in new textbox named txtProductNumber that bound to a field in the tbl_Produk.
My question are quite simple:
1. I want to validate txtProductNumber so that it can't be null. and if user force to close form with empty product number, data won't be saved . Where should i place validation code? I've tried to place it in form beforeupdate, with doCmd.cancelevent method. But it didn't work, because focus has to move to subform when txtProductNumber is still in null value (the value for txtProductNumber generate after some textbox in subform filled. How do i solve it?
2. How do i disable access warning, and replace it with my custom message when a data won't be saved?
2. Is wise to store product number in table for this case? i know that product number can be stored in a query or retrieved with a function when i need it. What is the standard choice, store in table or not?
Thanks