Greetings Gentlemen! Don't hate me yet :)
I, of course, revised the coding and hhmmm...
It seems to work correctly, but when it gets to the part where I put a statement in the coding "WHAT IS WRONG HERE", it does not do it correctly that if I deleted all of the records (meaning all matched and report "No Action"), it appends to TAB3 instead of TAB2.
***********
CASE _tally = ct && (means both tables has same counts, so need to verfiy side-by-side)
exitloop=.F.
SELECT histpo
COPY TO histtemp FOR po = varpo && (to be able to DELETE recs in a table, not in a cursor)
USE histtemp IN 0
SELECT tempcur
COPY TO temptemp && (to be able to DELETE recs in a tables, not in a cursor)
USE temptemp IN 0
SELECT temptemp
GO TOP
DO WHILE NOT EOF()
SELECT temptemp
varclass = temptemp.class
varfund = temptemp.fund
varudds = temptemp.udds
varamount = temptemp.amount
varfy = temptemp.fy
varactivity = temptemp.activity
varaccount = temptemp.account
SELECT histtemp
GO TOP
DO WHILE NOT EOF()
IF histtemp.class = varclass AND histtemp.fund = varfund AND histtemp.udds = varudds AND histtemp.amount = varamount AND histtemp.fy = varfy AND histtemp.activity = varactivity AND histtemp.account = varaccount
DELETE
SELECT temptemp
DELETE
EXIT
ELSE
SKIP
IF EOF()
exitloop=.T.
EXIT
ENDIF
ENDIF
ENDDO
IF exitloop=.T.
EXIT
ENDIF
ENDDO
**********
********** WHAT IS WRONG HERE
**********
FLUSH && maybe not needed?
SELECT histtemp
COUNT TO tp1
USE
SELECT temptemp
COUNT TO tp2
USE
IF tp1 = 0 and tp2 = 0
SELECT tab2
APPEND FROM DBF("tempcur")
ELSE
SELECT tab3
APPEND FROM DBF("tempcur")
ENDIF
DELETE FILE histtemp.dbf
DELETE FILE temptemp.dbf
Today is tomorrow's yesterday.