lacampeona
Registered User.
- Local time
- Today, 01:52
- Joined
- Dec 28, 2015
- Messages
- 392
Hello experts,
I need your opinion how would you make this in the database. I have problems with the statuses. I am not sure if I plan that correct or not.
You have 2 tables. Table A and Table B.
Table A = contains specific information about your item ( name, date arrrived, serial number, status of the item, etc...)
Item Name Status
1 A New
Table B = contains specific information about the usage for the specific item ( date of usage, where was used, status of the item)
Item Name Purpose if usage Status
1 A Testing method InUse
Example:
Users starts entering new data into database. This mean he entered first record and his item 1 has status New. Every time he will enter new item he will put status New.
So in the table A Item 1 has status New. That is correct.
Then user make the usage for the first time for the Item 1. He makes some testing and he choose from the combobox status InUuse.
So if we now want to check the table B and see the history of the item we will see that he make first use and he put the status InUse. That is all correct. So that mean that item 1 is no longer New becouse was used, item 1 has now status Inuse.
Now I need that the status for item 1 who has status InUse and which is stored in table B will be the same for the item 1 in the table A.
My Solution:
when user will choose from the combox the status inUse , I put code
with that the status will also be updated in table A. That is correct? Does exist another way to do that better? hmm
My problem:
Lets say user change the status from New to InUse...then he say ohhh I will close the form...I dont want to save the record..
I have code that ask user if he want to save the record or not, problem is when users choose the value from the combobox then the update code already change the status and record is not saved, So the record is not saved ( that is correct) but the status has changed. ( Not correct, if he close the form the status must be the same from the beggining in this case New).
If the status was new and user put InUse and then he close the form - the status is now InUse, = Is not correct. The status must be New again. This is correct.
How can I cancel the update command if users will close the form? how to prevent that. In which event I have to put the code? Before Update? On click?
How would yo do that? Can someone show me some example?
Thanks in advance
I need your opinion how would you make this in the database. I have problems with the statuses. I am not sure if I plan that correct or not.
You have 2 tables. Table A and Table B.
Table A = contains specific information about your item ( name, date arrrived, serial number, status of the item, etc...)
Item Name Status
1 A New
Table B = contains specific information about the usage for the specific item ( date of usage, where was used, status of the item)
Item Name Purpose if usage Status
1 A Testing method InUse
Example:
Users starts entering new data into database. This mean he entered first record and his item 1 has status New. Every time he will enter new item he will put status New.
So in the table A Item 1 has status New. That is correct.
Then user make the usage for the first time for the Item 1. He makes some testing and he choose from the combobox status InUuse.
So if we now want to check the table B and see the history of the item we will see that he make first use and he put the status InUse. That is all correct. So that mean that item 1 is no longer New becouse was used, item 1 has now status Inuse.
Now I need that the status for item 1 who has status InUse and which is stored in table B will be the same for the item 1 in the table A.
My Solution:
when user will choose from the combox the status inUse , I put code
DoCmd.RunSQL "UPDATE tblA SET tblA.Status= '(2) InUse ' WHERE tblA.ID = " & Me.ID
DoCmd.SetWarnings (True)
with that the status will also be updated in table A. That is correct? Does exist another way to do that better? hmm
My problem:
Lets say user change the status from New to InUse...then he say ohhh I will close the form...I dont want to save the record..
I have code that ask user if he want to save the record or not, problem is when users choose the value from the combobox then the update code already change the status and record is not saved, So the record is not saved ( that is correct) but the status has changed. ( Not correct, if he close the form the status must be the same from the beggining in this case New).
If the status was new and user put InUse and then he close the form - the status is now InUse, = Is not correct. The status must be New again. This is correct.
How can I cancel the update command if users will close the form? how to prevent that. In which event I have to put the code? Before Update? On click?
How would yo do that? Can someone show me some example?
Thanks in advance