PROCEDURE btn_val PARAMETER m.btnname CASE m.btnname = 'somestring' do some things CASE m.btnname = 'someotherstring' do some thing different *** and so on for 20 buttons or so ENDCASEIn one CASE the the user is marking the order complete so that the billing clerk can audit the order and send it to accounting.
CASE m.btnname = 'W_FINAL' SELECT CDM30WRK IF cmp_custid = 0 SELECT CDM10CMP LOCATE FOR cmp_code = mCMP_CODE IF cmp_custid <> 0 STORE cmp_custid TO lnCustID SELECT CDM30WRK LOCATE FOR wrk_order = mWRK_ORDER REPLACE NEXT 1 cmp_custid WITH lnCustID ENDIF SELECT CDM30WRK ENDIF IF SUBSTR(WRK_STAT,1,1) = "9" *** Audit this work order. If it is status complete, *** change to Accounting or COD DO CD300AUD IF sw_035 = "Y" @ 0.385,78.833 GET WRK_STAT PICTURE "@^" FROM ar_wstat; SIZE 1.538,11.333 ; DEFAULT "1-SCHED" ; FONT "MS Sans Serif", 8 ; STYLE "B" ; COLOR ,,,,,,,,RGB(255,255,255,128,128,0),RGB(255,255,255,128,128,0) DO CD017WAI sw_300 = "C" m.bailout = .T. &&this is needed if used with FoxApp CLEAR READ RETURN ENDIF ELSE *** if this is a normal user change the status to complete after popup *** change the status without a popup if user level is greater than 5 IF xUSR_LEVEL < "5" DO CD300FNL ELSE REPLACE NEXT 1 WRK_STAT WITH "9-COMPLT" REPLACE NEXT 1 pers_updt WITH xUSR_CODE ENDIF ENDIF mWRK_ORDER = WRK_ORDER SEEK mWRK_ORDER mWRK_PAGE = WRK_PAGE mITM_LINE = 1 DO save_old *** make sure we have a custid IF cmp_custid = 0 SELECT CDM10CMP LOCATE FOR cmp_code = mCMP_CODE IF cmp_custid = 0 DO client_export_to_mdb && exports to Access ENDIF STORE cmp_custid TO lnCustID SELECT CDM30WRK LOCATE FOR wrk_order = mWRK_ORDER REPLACE NEXT 1 cmp_custid WITH lnCustID ENDIF *** send the work order information to accounting. IF SUBSTR(WRK_STAT, 1, 1) = "A" OR SUBSTR(WRK_STAT, 1, 1) = "C" DO export_workorder_to_mdb && exports to Access ENDIF KEYBOARD "{ALT+1}" PLAINSo what is happening is that the routine is trying to export a client while the lower level user is executing the program. They do not have rights on that directory. They get a logon box from Access ODBC which fails, a wait window regarding a variable not found (since the export routine fails) that they can click though and the routine completes successfully.