Hi folks can anyone help please...
My database is a simple stock control one, you'ld think. The stock in question is work garments. I have two tables; tblsizes, tblstock. The tblsizes table has the following fields Size_id (autonum key field); Stock_ID (number); Size (text, cos it could include large, medium etc as well as numerical sizes); Qty (number). The tblStock has the fields Stock_ID (autonum key field) Stock_description. Both tables are linked by the STock_ID field in both tables.
I have two forms. One for data entry and one to view the data and show grand totals. The other is to allow data entry. The data entry form (frmStock) has a subform (frmSizes Subform). The user can enter the stock and the sizes and quantity of each size. The fields in the subform are displayed in datasheet view. It will be easier for the user to delete rows of data as and when required by simply hilighting the row in question and pressing the delete key. I have no way, yet, of deleting the stock should the user need to because of related records.
I hope there is sufficient "meat" in the above for you to be able to answer theses problems...
1- How can I delete a Stock Item (from the table tblStock) along with related records held in the tblSizes?
2 - How can I prevent the user putting duplicate values in the Size field?
With regard to 1, I have tried a delete query without success. Though that may be because I created it incorrectly.
With regard to 2, I have managed to prevent the user from inputting a duplicate Stock item. So, for instance, they couldn't enter Gloves twice. But the same routine doesn't seem to work with the Size field in the "frmSizes subform"
TIA
Regards
Herriot
My database is a simple stock control one, you'ld think. The stock in question is work garments. I have two tables; tblsizes, tblstock. The tblsizes table has the following fields Size_id (autonum key field); Stock_ID (number); Size (text, cos it could include large, medium etc as well as numerical sizes); Qty (number). The tblStock has the fields Stock_ID (autonum key field) Stock_description. Both tables are linked by the STock_ID field in both tables.
I have two forms. One for data entry and one to view the data and show grand totals. The other is to allow data entry. The data entry form (frmStock) has a subform (frmSizes Subform). The user can enter the stock and the sizes and quantity of each size. The fields in the subform are displayed in datasheet view. It will be easier for the user to delete rows of data as and when required by simply hilighting the row in question and pressing the delete key. I have no way, yet, of deleting the stock should the user need to because of related records.
I hope there is sufficient "meat" in the above for you to be able to answer theses problems...
1- How can I delete a Stock Item (from the table tblStock) along with related records held in the tblSizes?
2 - How can I prevent the user putting duplicate values in the Size field?
With regard to 1, I have tried a delete query without success. Though that may be because I created it incorrectly.
With regard to 2, I have managed to prevent the user from inputting a duplicate Stock item. So, for instance, they couldn't enter Gloves twice. But the same routine doesn't seem to work with the Size field in the "frmSizes subform"
TIA
Regards
Herriot