View Full Version : Help required : delete / update


goldstar19821982
03-14-2008, 10:45 AM
Hello All,

currently have a system which allows hiring of items. When an item is selected this is displayed within a listbox and saved within a table. If i was to press remove then this would clear the listbox, delete from the table and update the hired item within the item table.

Currenttly say i placed an hire order for 10 items, these would all display within a listbox, then if the remove button was to be pressed, all the items would be deleted from the table hireline. This works fine, but at the same time i want to update the stock within the item table.

for example item10 has total of 20 in item table
Order form, 1 of item9 is chosen and one of item10 is chosen and displayed within the listbox, this also saves the item within the itemline table
Then the remove button is pressed, currently i could get it to delete the items. but i want to update the stock for all items that were within the order

Uncle Gizmo
03-14-2008, 04:36 PM
I would recommend that you read Allen Browne's thread on this website (http://allenbrowne.com/AppInventory.html)here, it may give you some insight into how difficult it is to do.

goldstar19821982
03-15-2008, 05:57 AM
sorry, i shud have mentioned before, i have read thorugh allen browne site several times, but just cant the jist of how to do this.

Would you have a sample that would carry this task out. for edits and deletes?

Uncle Gizmo
03-15-2008, 06:09 AM
I don't have any samples myself, I strongly recommend that you take note of what allen browne suggests, particularly read the last part of his article, where he explains the pitfalls of not doing it with the approach he suggests.

In other words I would guess that you can dig yourself Into a big hole if you are not careful.

goldstar19821982
03-15-2008, 07:17 AM
Hi there, thank you for the information

One more question on delete

I got a transactionlist form where the ordered items are displayed for that order. For this form information is selected from an hireline and hire table
When deleting records, i want to remove any references for that order
this is what i am using but with no success....
Any ideas?


[Code]
CurrentDatabase.Execute ("Delete * from tblhireline Where hireno=" & Forms!frmtansactionlist!txthireno)
CurrentDatabase.Execute ("Delete * from tblhire Where hireno=" & Forms!frmtansactionlist!txthireno)
[code]

goldstar19821982
03-17-2008, 02:54 PM
anyone possible to help me with this?

goldstar19821982
03-18-2008, 04:47 PM
any ideas?

ajetrumpet
03-18-2008, 05:54 PM
i want to remove any references for that order
this is what i am using but with no success....
Any ideas?


[Code]
CurrentDatabase.Execute ("Delete * from tblhireline Where hireno=" & Forms!frmtansactionlist!txthireno)
CurrentDatabase.Execute ("Delete * from tblhire Where hireno=" & Forms!frmtansactionlist!txthireno)
[code]Why is it not successful?? Are you getting a debug request? Is the statement being highlighted?? Get any error messages??

The first thing I see is that you have enclosed a quoted statement (e.g. - a string value) in brackets. That, for the most part, is a no-no, as far as I'm concerned. If you're getting an error message, get rid of the () characters and see what that does for you first...

If that is not the problem, you may be referring to the form control incorrectly (i.e. - "txthireno" is a string value instead of another data type)