try OpenTable(goWCServer.oConfig.oTask.cBTSPath+[key\A]+m.bn,[AppExp]) catch to loError messagebox(loError.message) endtryI am wondering if you are trying to open another table without closing the first one. The following will fail because the alias atable is still being used. You also might try putting the closetable function inside the for loop.
use a1 alias atable select into new cursor use a2 alias atable.>>>I'll just post the whole function, I didn't include some parts because I didn't think they played a part in what I was trying to do, but obviously I don't know what I'm doing so maybe this was the problem all along.
FUNCTION ApprovalPrintout >>> SET STEP ON >>> m.bnin = "" >>> m.bn = "" >>> m.ty = "" >>> *Set variables to input from HTML page >>> m.bnin = ALLTRIM(TRANSFORM(Request.Form("bn"))) >>> m.ty = ALLTRIM(Request.Form("btntype")) >>> m.msg = "" >>> >>> >>> IF EMPTY(m.bnin) >>> IF EMPTY(m.ty) >>> m.msg="You Need To Enter A Batch Number" >>> ELSE >>> m.msg="Shouldnt Get this" >>> ENDIF >>> >>> >>> ELSE >>> >>> >>> NumberRecords = GETWORDCOUNT(m.bnin) >>> FOR i = 1 TO NumberRecords >>> m.bn = PADL(GetWordNum(m.bnin, i, ","),7,"0") >>> >>> *Opens the DBF file in the "key" folder, appends "A" and adds the user input as batch number >>> OpenTable(goWCServer.oConfig.oTask.cBTSPath+[key\A]+m.bn,[AppExp]) >>> >>> *Select columns from table above, name them for Excel headers >>> SELECT bn as [BatchNum],; >>> pk as [RecNo],; >>> "" as [Approved],; >>> shdt as [ShipDate],; >>> canm as [Carrier],; >>> prno as [Pro],; >>> blno as [BOL],; >>> shnm as [Shipper],; >>> ozp as [OZip],; >>> conm as [Consignee],; >>> dzp as [DZip],; >>> wtttl as [Weight],; >>> "" as [ReWeigh],; >>> "" as [Notes],; >>> accd1 as [Acc1],; >>> acamt1 as [Amt1],; >>> accd2 as [Acc2],; >>> acamt2 as [Amt2],; >>> accd3 as [Acc3],; >>> acamt3 as [Amt3]; >>> FROM AppExp; >>> into cursor ApprovalA >>> >>> SELECT ApprovalA >>> >>>*Copy data from cursor to Excel file >>>COPY TO ("C:\test\"+[bn]+m.bn+[T2.xls]) >>> >>>m.msg=[File Exported to C:\test\bn]+m.bn+[T2.xls] + TRANSFORM(NumberRecords) >>>ENDFOR >>> CloseTable("AppExp") >>> >>> >>> >>> ENDIF >>> >>> Response.ExpandTemplate(goWCServer.oConfig.oTask.cBTSHTMPath+"ApprovalPrintout.htm") >>> >>> >>>ENDFUNC>>>