Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TableUpdate in View
Message
From
09/08/2000 23:08:28
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00403088
Message ID:
00403231
Views:
12
>* A litle rewrite, with a different approach:
>
PROCEDURE clsdtlbtns.cmdSave.Click
>LOCAL cTempAlias,aFldStruct[1],oScatterObj,cAliasIn,tNewEMo,cOrder
>cAliasIn = ALIAS()
>cTempAlias = SYS(2015)
>tNewEMo = thisform.txtEffMo.value
>SELECT 0
>cOrder = ORDER('TAcustView')
>=AFIELDS(aFldStruc,'TAcustView')
>CREATE CURSOR (cTempAlias) FROM ARRAY aFldStruc
>SELECT TAcustView
>SET ORDER TO 0
>SCAN FOR actflag and ! EMPTY(assumer)
>   SCATTER NAME oScatterObj MEMO
>   WITH oScatterObj
>      *  If any fields in TAcustView get filled automagically by defaults in
>      *  the DBC at create, excluse them in SCATTER using the EXCEPT clause
>      *
>      .taid = .assumer
>      .assumer = ''
>      .effsysdt = DATETIME()
>      .effmo = tNewEmo
>      .user = gcUser
>   ENDWITH
>   SELECT (cTempAlias)
>   APPEND BLANK
>   GATHER NAME oScatterObj MEMO
>   SELECT TAcustView
>   repl endmo with tNewEMo, endsysdt with datetime(), actflag with .F.
>ENDSCAN
>*  You never reprocess the new records, since they haven't been added yet
>APPEND FROM (DBF(cTempAlias))  && pull in the cursor
>USE IN (cTempAlias)
>=tableupdate(1,.T.,"TAcustView")
>SET ORDER TO &cOrder
>LOCATE
>thisform.showdetails(.F.)
>IF ! EMPTY(cAliasIn)
>   SELECT (cAliasIn)
>ELSE
>   SELECT 0
>ENDIF
>ENDPROC
Hi Ed,

Thanks for your help. I tried your code but it still doesn't work... although if I just make one change, it works fine, but I tried more than one change, the REquery looped quite several times again. Then I tried again for the same TA rep (without closing the form), I got an error message "table buffer for alias "tacustview" contains uncommitted changes." I find that strange because its buffermode was 5. I checked the table and found all the changes (end month & actflag --> .F.) were committed, however, only one appended record (the first assumer & actflag --> .T.) was committed, but not the rest. :\

So, instead of appending the new records into the view, I had the cTempAlias appended into the actual table (TAcust), this solves the uncommitted changes error message. Still the "Running query" message looped.....
Thanks!
~d
J
Previous
Reply
Map
View

Click here to load this message in the networking platform