home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / ADDREC.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  1.1 KB  |  47 lines

  1. /*
  2.    Program: ADD_REC()
  3.    System: GRUMPFISH LIBRARY
  4.    Author: Greg Lief
  5.    Copyright (c) 1988-90, Greg Lief
  6.    Clipper 5.x Version
  7.    Compile instructions: clipper addrec /n/w/a
  8.    Attempts to APPEND BLANK in multi-user environment
  9. */
  10.  
  11. //───── begin preprocessor directives
  12.  
  13. #include "grump.ch"
  14. #include "inkey.ch"
  15.  
  16. //───── end preprocessor directives
  17.  
  18.  
  19. function Add_Rec(waittime)
  20. //───── establish condition to wait for record to be appended
  21. //───── if user passed parameter, use that as number of seconds to wait;
  22. //───── otherwise, wait until the user presses the Esc key
  23. local start, waitcond := if(waittime == NIL, { || lastkey() != K_ESC}, ;
  24.       { || seconds()-start < waittime})
  25. if len(alias()) = 0    && no database in use
  26.    return .f.
  27. endif
  28. append blank
  29. if ! neterr()
  30.    return .t.
  31. else
  32.    start := seconds()
  33.    do while eval(waitcond)
  34.       append blank
  35.       if ! neterr()
  36.          return .t.
  37.       endif
  38.    enddo
  39.    Err_Msg('Cannot add record at this time')
  40. endif
  41. return .f.
  42.  
  43. * end function Add_Rec()
  44. *--------------------------------------------------------------------*
  45.  
  46. * eof addrec.prg
  47.