473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Delete

Hello All,

Currently i have a transaction list form which displays all the transactions which have been saved.
If the client no longer requires the order, there is a remove button which would delete this: see code below
This works fine,it deletes all the items within the listbox and client details but i want it to update the stock levels for all the items within the listbox when remiove is prssed.

Would anyone know how this can be achieved?
[code]

database.Execute ("Delete * from tbltransaction Where Hireno = " & Chr(34) & Forms!frmtransactionlist!txthireno) & Chr(34)

dbase.Execute ("Delete * from tbltransactionline Where hireno =" & Forms!frmtransactionlist!txthireno)

[code]

I think the best way to do this for me is via a loop method, but im not too sure how to achieve this

Any help would be appreciated
Mar 19 '08 #1
2 935
ADezii
8,834 Expert 8TB
Hello All,

Currently i have a transaction list form which displays all the transactions which have been saved.
If the client no longer requires the order, there is a remove button which would delete this: see code below
This works fine,it deletes all the items within the listbox and client details but i want it to update the stock levels for all the items within the listbox when remiove is prssed.

Would anyone know how this can be achieved?
[code]

database.Execute ("Delete * from tbltransaction Where Hireno = " & Chr(34) & Forms!frmtransactionlist!txthireno) & Chr(34)

dbase.Execute ("Delete * from tbltransactionline Where hireno =" & Forms!frmtransactionlist!txthireno)

[code]

I think the best way to do this for me is via a loop method, but im not too sure how to achieve this

Any help would be appreciated
You will have to provide much more detailed information than this, such as:
  1. Table names.
  2. Fields contained within these Tables & their Data Types.
  3. Primary Key Fields in Tables and their Data Types.
  4. Relationships between Tables, and the Parent and Child Field names.
  5. Row Source for the List Box.
  6. Bound Column for the List Box.
  7. Table & Field where the Stock levels are stored.
  8. etc.
Mar 19 '08 #2
You would need to setup some variables to hold the values before you deleted them. You would pull these items using a select statement, then set the values. For example:
Dim strSql as string
Dim rs as recordset
Dim iItem as integer
dim sItemDef as string
dim strsql2 as string


strSql-"Select * from mytable where fldItemID = " & YourItemID & "
set rs=currentdb.openrecordset(strsql)

if rs.eof then
exit sub
else
'keep going
end if

do until rs.eof

iItem=rs.fields("fldItemid").value
sItemdef=rs.fields("fldItemDef").value 'Where the quoted names represent your field names

strsql2="insert into myinventorytable (flditemid,flditemdef) VALUES (" & item & ", " & sItemdef & ")"

docmd.runsql(strsql)

rs.movenext
loop
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''

You could run your delete query after you were done with everything, or include it in the loop to do it on an item by item basis
hope this helps
Mar 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dave | last post by:
Hello all, In the code below, I see the following output: base::operator new(size_t, int) base::base() base::~base() base::operator delete(void *) In the case of an exception being thrown...
1
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. In fact there...
3
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. I am...
1
by: Douglas Peterson | last post by:
class Allocator { public: virtual void * Alloc(size_t) = 0; virtual void * Free(void*) = 0; }; class Object { public:
2
by: Dave | last post by:
Hello all, I'd like to find a source on the web that discusses, in a comprehensive manner and in one place, everything about new / delete. It should include overloading operator new, the new...
3
by: silver360 | last post by:
Hello, I'm trying to create a basic Heap manager and i have some question about new/delete overloading. The following code give me this output : >> $./heap >> registered : 0x804d098 >>...
9
by: rohits123 | last post by:
I have an overload delete operator as below ////////////////////////////////// void operator delete(void* mem,int head_type) { mmHead local_Head = CPRMemory::GetMemoryHead(head_type);...
10
by: jeffjohnson_alpha | last post by:
We all know that a new-expression, foo* a = new foo() ; allocates memory for a single foo then calls foo::foo(). And we know that void* p = ::operator new(sizeof(foo)) ; allocates a...
15
by: LuB | last post by:
I am constantly creating and destroying a singular object used within a class I wrote. To save a bit of time, I am considering using 'placement new'. I guess we could also debate this decision -...
29
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I remembered delete is implemented through operator overloading, but I am not quite clear. Could anyone recommend some links about how delete is implemented so that I can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.