Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving and deleting data

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I am looking to move user specified data from its table of origin to a new table. The data is to be completely removed from the original table/

Has anyone any ideas on this? I have done similar things using SQL code and queries but wondered if anyone had an efficient way of removing data from one table and transferring it into another.

Thanks all,

Woody.
 
You would use a 'Delete' query. The resulting table would be called Deleted.db and would show up in your PRIV directory. You could rename it or add it to another table. To do this interactively you just bring up the QBE tool, put in your field criteria (date range, etc...) but don't check any fields. Then right-click under the table name and pick DELETE from the drop-down list. You can save this query just like any other and paste it into your code.



Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
A word of caution: Yes, DELETED.DB tables are real tables, but if you intend to save them or to add their data into other tables, be sure to rename them before you do anything else.

DELETED is a temporary table, meaning that you may unintentionally lose it and its data.

Hope this helps...

-- Lance
 
Hi all,

on this subject of moving and deleting data, what would be the best method of automating a stock control system? I have a parts table which has each stock item with a unique part number. This acts as a look up to a lineiten
tableband on the invoicing form. I should like to be able to enter the part into the lineitem and then move and delete that said item from the parts table and move it into an archive table- I would then in theory have a live stock value at all times.........in theory!

Any suggestions gratefully received.

Thanks from sunny England

Lewy
 
Lewy,

I'd use something similar to the script below:

method pushButton(var eventInfo Event)

var
lineit String
list,
qVar Query
dt DataTransfer
endvar


lineit = lineitem.value

setMouseShape(MOUSEWAIT,TRUE)

qVar = Query

:WORK:LineItem | Lineitem |
Delete |~lineitem |

endQuery

if not qVar.executeQBE() then
errorshow()
endif

dt.SetSource ( ":pRIV:Deleted.db" )
if dt.getSourceType ( ) = DTASCIIFixed Then
dt.loadDestSpec ( "SpecTable" )
endIf
dt.setDest ( "Archive.db" )
if not dt.getAppend () then
dt.setAppend ( True )
endif
dt.transferData ( )

setMouseShape(MOUSEARROW, TRUE)

endMethod

You may need to tinker about with this a bit but I think that this is the sort of thing you need.

Hopefully helps anyway, from rainy Wales!

Woody.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top