Robbyp2001
Registered User.
- Local time
- Today, 16:45
- Joined
- Oct 8, 2011
- Messages
- 143
Hello folks
I would be grateful for any suggestions to solve the below problem. It's a fairly straightforward problem, but incredibly difficult to explain straightforwardly. I will try though.
As part of a stock control database, there is a facility for parents to purchase school uniforms and the process is thus: Each item is stored in [OrderTbl] and the facility is there to return items ordered erroneously back to stock.
However, occasionally an item is returned as ‘damaged’ and this has to be removed from [OrderTbl] and appended to [DamagedReturnsArchive].
OrderTbl:
[OrderID] Autonumber
[StudentID] Customer Id number
[Dateentered] Date of purchase
[Timeentered] Time of Purchase
[Numentered] Number of the Item purchased
[ItemClassLevel3ID] (Unique ItemID)
(Identical named fields appear in [DamagedReturnsArchive])
This is currently done by running two queries
1. Append Query "AppendDamagedItemstoArchiveTble"
2. Delete Query "RemoveDamagedItemsFromOrderTbl"
A previously unforeseen problem has now occurred to me. On a rare occasion a customer may purchase more than one of any item, for example ‘2 short sleeved t-shirts XXL’ but might be unhappy with one of them and wishes to return it.
At this time the above purchase is stored in the order table with the ItemID but with [NumEntered]=2. When the return process above is activated the complete order of 2 items is archived rather than only the single returned item.
What I’m trying to achieve is this:
On click
If [OrderTble]![Numentered]=1 then Append the record to [DamagedReturnsArchive] then delete record from [OrderTble]
If [OrderTble]![Numentered]>1
Msg “There are [number?] identical items in this order. How many do you wish to return?”
Response [user input number] or [All]
If the [User Input Number] =< [OrderTble]![Numentered] Then append to [DamagedReturnsArchive] and update [DamagedReturnsArchive]![numentered] to [User Input Number]. Then subtract that number from [OrderTble]![Numentered]
Simply put, I am trying to return at least one item from an order containing more than one identical item to an archive table. The actual number of items to be returned in this case will be determined by the user, then the new balance (Numentered-Number selected) updated in the original table.
Thankfully a scenario like that above is extremely rare but as Murphy’s Law states, if it can happen, it inevitably will happen. I can make the adjustments manually by editing the two tables but I cannot expect the database user to do that.
I realised as I was typing this that there may be some flaws in my logic. I apologise for this but I have very little knowledge of code.
I'd be very grateful for any suggestions made
Rob
I would be grateful for any suggestions to solve the below problem. It's a fairly straightforward problem, but incredibly difficult to explain straightforwardly. I will try though.
As part of a stock control database, there is a facility for parents to purchase school uniforms and the process is thus: Each item is stored in [OrderTbl] and the facility is there to return items ordered erroneously back to stock.
However, occasionally an item is returned as ‘damaged’ and this has to be removed from [OrderTbl] and appended to [DamagedReturnsArchive].
OrderTbl:
[OrderID] Autonumber
[StudentID] Customer Id number
[Dateentered] Date of purchase
[Timeentered] Time of Purchase
[Numentered] Number of the Item purchased
[ItemClassLevel3ID] (Unique ItemID)
(Identical named fields appear in [DamagedReturnsArchive])
This is currently done by running two queries
1. Append Query "AppendDamagedItemstoArchiveTble"
2. Delete Query "RemoveDamagedItemsFromOrderTbl"
A previously unforeseen problem has now occurred to me. On a rare occasion a customer may purchase more than one of any item, for example ‘2 short sleeved t-shirts XXL’ but might be unhappy with one of them and wishes to return it.
At this time the above purchase is stored in the order table with the ItemID but with [NumEntered]=2. When the return process above is activated the complete order of 2 items is archived rather than only the single returned item.
What I’m trying to achieve is this:
On click
If [OrderTble]![Numentered]=1 then Append the record to [DamagedReturnsArchive] then delete record from [OrderTble]
If [OrderTble]![Numentered]>1
Msg “There are [number?] identical items in this order. How many do you wish to return?”
Response [user input number] or [All]
If the [User Input Number] =< [OrderTble]![Numentered] Then append to [DamagedReturnsArchive] and update [DamagedReturnsArchive]![numentered] to [User Input Number]. Then subtract that number from [OrderTble]![Numentered]
Simply put, I am trying to return at least one item from an order containing more than one identical item to an archive table. The actual number of items to be returned in this case will be determined by the user, then the new balance (Numentered-Number selected) updated in the original table.
Thankfully a scenario like that above is extremely rare but as Murphy’s Law states, if it can happen, it inevitably will happen. I can make the adjustments manually by editing the two tables but I cannot expect the database user to do that.
I realised as I was typing this that there may be some flaws in my logic. I apologise for this but I have very little knowledge of code.
I'd be very grateful for any suggestions made
Rob