I'll try to be as brief as possible.
The client wants to be able to add/remove items from an invoice by clicking small 'plus/minus' buttons.
I've accomplished this by making one table which contains orderID and the name of *all* spare parts, then hooking up each pair of buttons on the form to this code:
I have a feeling I'm doing something horribly wrong, though.
If my understanding is correct, the tables are not normalized in this way.
Looking at the Northwind template, a separate table with the spare parts info and one with invoice info would be preferable.
With that said, these are my 2 questions:
Is it possible to make several 'IF/IIF/WHERE' statements in SQL, so I'll only grab the entry if value is > 0?
(Basically to avoid printing all the parts, where the quantity is 0, on the invoice.)
How would I redo the tables and 'plus/minus' buttons if I want the data to be normalized? (I guess the plus should check if an entry exists, and create it if it doesn't or increment the quantity if it does, while the minus should find an entry and decrease the quantity by 1 or delete the entry if quantity = 0.)
I hope I've been able to explain the problem clearly.
Any and all advice is much appreciated! Even a nod in the right direction would help.
JJ
The client wants to be able to add/remove items from an invoice by clicking small 'plus/minus' buttons.
I've accomplished this by making one table which contains orderID and the name of *all* spare parts, then hooking up each pair of buttons on the form to this code:
Code:
Private Sub btnPartName1Plus_Click()
Me.PartName1 = Me.PartName1 + 1
End Sub
Private Sub btnPartName1Minus_Click()
Me.PartName1 = Me.PartName1 - 1
If Me.PartName1 < 0 Then Me.PartName1 = 0
End Sub
If my understanding is correct, the tables are not normalized in this way.
Looking at the Northwind template, a separate table with the spare parts info and one with invoice info would be preferable.
With that said, these are my 2 questions:
Is it possible to make several 'IF/IIF/WHERE' statements in SQL, so I'll only grab the entry if value is > 0?
(Basically to avoid printing all the parts, where the quantity is 0, on the invoice.)
How would I redo the tables and 'plus/minus' buttons if I want the data to be normalized? (I guess the plus should check if an entry exists, and create it if it doesn't or increment the quantity if it does, while the minus should find an entry and decrease the quantity by 1 or delete the entry if quantity = 0.)
I hope I've been able to explain the problem clearly.
Any and all advice is much appreciated! Even a nod in the right direction would help.
JJ
Last edited: