Update query to avoid going over a number

ChrisSedgwick

Registered User.
Local time
Today, 22:03
Joined
Jan 8, 2015
Messages
119
Hi all,,

I've been asked to work on a new "Installations" section of our database. I didn't design the database itself, so it's always a little difficult to make sure anything new that is implemented works as it should. I won't bore you with all the details regarding the new section as our set-up is a little different. However, The outline basically means we can issue our fitters with what we're calling a "Fitter Order Ticket", which is linked to a job on our system and then to a specific Product within that job. The Fitter Order is linked by

Product ID, which is linked to Phase ID (as we can have many Phases on a job), which is then linked by Job ID.

The set up so far means that we are able to send Fitter Order Tickets as we want and this side of the new section works great!

What I now want to do is to set up a section that will allow us to input what the fitter has actually installed. This way we can run off all types of reports and statements for P & L purposes.

Again, I've created most of the cosmetic stuff however I'm struggling to keep some sort of running total going. So for example,

We send a Fitter Order Ticket to a Fitter for 10 items, they fit 5. We enter 5 into our system. We now how 5 remaining, and preferably we want to know this whenever we issue another tickets for the same Product/Item.

So, we send the remaining 5 as a new Fitter Order Ticket to a different fitter. He sends his invoice back to us and tells us he has fitted 6. Obviously this is over the remaining total and this would need to flag up.

I'm sure that this would be done as an update query, however it's not something I've done before.

Could someone suggest how I would go about doing this?

Thanks in advance.

Chris.
 
Chris,

Can you post a jpg of your Relationships window so readers can get an overview of your database structure?
I see Installations, Ticket, Order, Product, Item, Fitter, Phase, Invoice, P&L and Job (at least) but don't know how these are related.
 
Hi jdraw,

Apologies, I didn't think to add the relationship structure (how did I assume members were going to be able to help without this?). I have now attached a screen shot of my relationship structure. Hopefully this will help.

Please let me know if you require any more information.

Thanks,
Chris.
 

Attachments

  • Relationship.PNG
    Relationship.PNG
    86.5 KB · Views: 127
Chris,

Just looked briefly at your PNG.

Somehow Fitter should relate to FitterOrder, and it would seem that FitterProduct should relate to FitterOrder ---but you know your application better than readers do. So perhaps you could give us some details --- a typical day in the life sort of thing - to help us understand.
 

Users who are viewing this thread

Back
Top Bottom