TheLazyPig
Programmer
Hi!
I'm going to create a form that uploads a single .dbf file and use it as a table for extraction.
Below is the form layout...
textbox = disabled; views the file name uploaded
Upload = should get the .dbf file in the local driver of the user
Extract = after upload, extract the file using SELECT
I used GETFILE() to get the file and put the filename in the textbox.
Upload File Button
Extract Button
However, I get an error from gcFile. It can't locate the local variable that I used from the upload button.
The location and name of the file uploaded should be the path (set default to) of the extraction.
Thank you!!!
I'm going to create a form that uploads a single .dbf file and use it as a table for extraction.
Below is the form layout...
textbox = disabled; views the file name uploaded
Upload = should get the .dbf file in the local driver of the user
Extract = after upload, extract the file using SELECT
I used GETFILE() to get the file and put the filename in the textbox.
Upload File Button
Code:
CLOSE DATABASES
SELECT 0
LOCAL gcFile
gcFile = GETFILE('DBF','Browse','Browse')
thisform.txtFileName.Value = JUSTFNAME(gcFile)
IF !EMPTY(ThisForm.txtFileName.Value)
thisform.btnExtract.enabled = .T.
ENDIF
Extract Button
Code:
SET CENTURY OFF
SET CENTURY ON
SET DELETED ON
SET SAFETY OFF
SET UDFPARMS TO REFERENCE
CLOSE ALL
CLEAR
LOCAL lcDir, lcFile
lcTest = "'C:\RECOMPUTE\RECOMPUTE2\'"
lcDir = gcFile
lcFile = "'C:\BACKUP_FILES\AGLIB_EXTRACT\'"
USE lcDir IN 0 SHARED NOUPDATE
SET DELETED ON
SELECT * FROM AGLIB WHERE rec_status <> 'D'
IF MESSAGEBOX("Extract Agent Library?",36,"Confirmation") = 6
COPY TO lcFile+"aglib_extract" TYPE XL5
MESSAGEBOX("File [aglib_extract.xls] Created!")
ELSE
MESSAGEBOX('Extraction Cancelled')
RETURN 0
ENDIF
However, I get an error from gcFile. It can't locate the local variable that I used from the upload button.
The location and name of the file uploaded should be the path (set default to) of the extraction.
Thank you!!!