In my program, before the main dialog window runs, I run a windows explorer window so that the user can select a folder which contains the DBF needed to run the main dialog. If the program finds the DBF then the main dialog will run, however, if it is not found, the program shows a message to tell the user that the DBF does not exist in the folder they have chosen and then ends the program. However, although the message displays correctly, if the user clicks the ok button to remove the message from the screen i get a base error 1002 (Alias Does Not Exist) displayed. I know I could solve this by placing the DBF into every folder, but i was wondering if there was another way to end the program without doing that?
CODE;
STATIC FUNCTION OpenRepDets()
LOCAL RetVal := .F.
LOCAL mFileName := ALLTRIM(mDataSet)+"\REPDETS.DBF"
IF FILE(mFileName)
IF SELECT("REPDETS") <> 0
REPDETS->(DBCLOSEAREA())
ENDIF
IF SELECT("REPDETS") == 0
mFileName := ALLTRIM(mDataSet)+"\REPDETS"
IF NET_USE(mFileName,.F.,5)
RetVal := .T.
SET INDEX TO &mFileName.
PRIVATE RangeFields[FCOUNT()]
AFIELDS (RangeFields)
mRdName := ASCAN(RangeFields,"REP_DESCR") > 0
mRdParam := ASCAN(RangeFields,"REP_PARAM") > 0
mRdComm := ASCAN(RangeFields,"REP_COMM") > 0
ENDIF
ENDIF
ELSE
msginfo(mdataset)
MsgInfo("Report Ranges File Not Found")
ENDIF
RETURN RetVal
Thanks in advance for any help!
Error Base\1002
-
- Posts: 22
- Joined: Wed Nov 09, 2005 9:43 am
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 22
- Joined: Wed Nov 09, 2005 9:43 am
- Contact:
Antonio,
I have placed those lines into the code now, but am still getting the 1002 error, here is the code after the lines have been added, have I missed something??
CODE;
STATIC FUNCTION OpenRepDets()
LOCAL RetVal := .F.
LOCAL mFileName := ALLTRIM(mDataSet)+"\REPDETS.DBF"
IF ! FILE(mFileName)
return .f.
endif
IF FILE(mFileName)
IF SELECT("REPDETS") <> 0
REPDETS->(DBCLOSEAREA())
ENDIF
IF SELECT("REPDETS") == 0
mFileName := ALLTRIM(mDataSet)+"\REPDETS"
IF NET_USE(mFileName,.F.,5)
RetVal := .T.
SET INDEX TO &mFileName.
PRIVATE RangeFields[FCOUNT()]
AFIELDS (RangeFields)
mRdName := ASCAN(RangeFields,"REP_DESCR") > 0
mRdParam := ASCAN(RangeFields,"REP_PARAM") > 0
mRdComm := ASCAN(RangeFields,"REP_COMM") > 0
ENDIF
ENDIF
ELSE
MsgInfo(mdataset)
MsgInfo("Report Ranges File Not Found")
ENDIF
msginfo(1)
RETURN RetVal
Many Thanks
I have placed those lines into the code now, but am still getting the 1002 error, here is the code after the lines have been added, have I missed something??
CODE;
STATIC FUNCTION OpenRepDets()
LOCAL RetVal := .F.
LOCAL mFileName := ALLTRIM(mDataSet)+"\REPDETS.DBF"
IF ! FILE(mFileName)
return .f.
endif
IF FILE(mFileName)
IF SELECT("REPDETS") <> 0
REPDETS->(DBCLOSEAREA())
ENDIF
IF SELECT("REPDETS") == 0
mFileName := ALLTRIM(mDataSet)+"\REPDETS"
IF NET_USE(mFileName,.F.,5)
RetVal := .T.
SET INDEX TO &mFileName.
PRIVATE RangeFields[FCOUNT()]
AFIELDS (RangeFields)
mRdName := ASCAN(RangeFields,"REP_DESCR") > 0
mRdParam := ASCAN(RangeFields,"REP_PARAM") > 0
mRdComm := ASCAN(RangeFields,"REP_COMM") > 0
ENDIF
ENDIF
ELSE
MsgInfo(mdataset)
MsgInfo("Report Ranges File Not Found")
ENDIF
msginfo(1)
RETURN RetVal
Many Thanks
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 22
- Joined: Wed Nov 09, 2005 9:43 am
- Contact: