Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7098119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:00:58+00:00 2026-05-28T11:00:58+00:00

I m new to foxpro and it s work areas are something i don

  • 0

Im new to foxpro and its work areas are something i dont really dont get so that`s likely where the problem is.

Basically i have a form that takes 2 .csv files and puts them into foxpro tables.

I get a run time error at the last line of this, can anyone see the problem?

web_file    = Thisform.mcFile
web_file2   = thisform.mcfile2
web_letter  = Thisform.mcLetter
web_gl      = Thisform.mcGl
web_gl2     = Thisform.mcGl2
Set Date To Dmy

Close Data

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

mcFile  = Thisform.mcFile
mcFile2 = Thisform.mcFile2

Wait Clear

If File("web_temp.dbf")
    Delete File web_temp.Dbf
Endif
Create Table web_temp (;
    email1          C(40),;
    opentime1       C(40),;
    o2idnumb1       C(10))

Use
Select 0
USE web_temp Exclusive
Append From &web_file Delim

If File("web_temp2.dbf")
    Delete File web_temp2.Dbf
Endif
Create Table web_temp2 (;
    email           C(40),;
    opentime        C(40),;
    o2idnumb        C(10))  

Use
Select 0
USE web_temp2 Exclusive

APPEND FROM &web_file2 Delim

Also, im not the original author, im the maintenance guy. so if things look weird its because ive been using his code without really understanding it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:00:58+00:00Added an answer on May 28, 2026 at 11:00 am

    Yup, looks like very old code but let me try to help you understand what is going on…

        */ create local memory variables (web_file, web_file2, etc) from properties
        */ that exist on the form (Thisform.mcFile, Thisform.mcFile2)  No problems here
            web_file    = Thisform.mcFile
            web_file2   = thisform.mcfile2
            web_letter  = Thisform.mcLetter
            web_gl      = Thisform.mcGl
            web_gl2     = Thisform.mcGl2
    
    */ If doing an import of data that is "Date" based, Foxpro will expect it in
    */ Day Month Year format, but you don't appear to be doing anything with it 
    */ during your import of CSV file
            Set Date To Dmy
    
    */    Close database(s) that may be open
            Close Data
    
            * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    
    */ Does the exact same as above with "web_file" and "web_file2", 
    */ so you now have two variables each with exact same values...
            mcFile  = Thisform.mcFile
            mcFile2 = Thisform.mcFile2
    
    */    clear the "wait" window
            Wait Clear
    
    
    */ Look to see if there is an old version of "Web_Temp.dbf", if so, 
    */ delete it and recreate it with the provided "create table" structure. 
            If File("web_temp.dbf")
                Delete File web_temp.Dbf
            Endif
            Create Table web_temp (;
                email1          C(40),;
                opentime1       C(40),;
                o2idnumb1       C(10))
    
    */ These three lines are not needed.  When you "CREATE TABLE", you are 
    */ explicitly STARTING the file in exclusive mode, no need to close 
    */ and re-open exclusively.
            Use
            Select 0
            USE web_temp Exclusive
    
    
    */ Take the content from the file by the name found in the variable "web_file".  
    */ This could cause a problem if the file has embedded spaces in the name... 
    */ the preferred method is to use ( parens ).  The expectation of "Delim" is 
    */ that the file is comma delimited between each expected column name
            && Append From &web_file Delim
            Append from (web_file) Delim
    
    */ Do the same here, but for the second file going into a second 
    */ "Temp" table for processing 
            If File("web_temp2.dbf")
                Delete File web_temp2.Dbf
            Endif
            Create Table web_temp2 (;
                email           C(40),;
                opentime        C(40),;
                o2idnumb        C(10))  
    
    */    Again, dont need this
            Use
            Select 0
            USE web_temp2 Exclusive
    
            && APPEND FROM &web_file2 Delim
            append from (web_file2) Delim
    

    Now, all that said, here is some super shortcuts for you, especially if these are in fact temporary tables that you would otherwise be “discarding” when finished…

    */ The above doesn’t confirm expected files exist, so I would pre-check

    if not file( Thisform.mcFile )
       messagebox( "Sorry, the file " + Thisform.mcFile + " does not exist" )
       return
    endif 
    
    if not file( Thisform.mcFile2 )
       messagebox( "Sorry, the file " + Thisform.mcFile2 + " does not exist" )
       return
    endif 
    
    */ In case a cursor/table is already open by the name "Web_Temp", close it
    use in select( "Web_Temp" )
    */ Create a new table (temporary table that automatically 
    */ erases itself when closed when you are finished with it
    create cursor Web_Temp (;
            email1          C(40),;
            opentime1       C(40),;
            o2idnumb1       C(10))
    
    */ Append from the file as before
    append from ( Thisform.mcFile ) delim
    
    */ Go to another "work area" VFP allows up to 65535 different work areas, but if you
    */ ever needed that many tables open simultaneously, you have bigger problems.
    select 0
    
    */ Same here, but for your SECOND table
    use in select( "Web_Temp2" )
    Create cursor web_temp2 (;
            email           C(40),;
            opentime        C(40),;
            o2idnumb        C(10))  
    
    */ Append from the file as before
    append from ( Thisform.mcFile2 ) delim
    
    */ Done, continue with rest
    

    If you have a file that is underlying as hex values, they’ll just be pulled-in verbatim as would be seen in a notepad editor. (or via MODIFY COMMAND NameOfTheFile) from within VFP

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NEW EDIT: I have narrowed my problem to this - i have a view
We have an application that creates a number of Visual Foxpro (DBF) tables. Each
New to StackOverflow here. I'm working on the first Euler problem and have run
New to iPhone app development, I have a problem compiling (or Build and Run)
I have a foxpro database that we are trying to write to using MS
New to cpp (Java guy). I have 3rd party library that has method sendMail(txt).
I am VERY new to FoxPro so please pardon what is most likely a
I have an Excel 2007 workbook that contains an ODBC data connection (to FoxPro,
New bie here. I have been working on readers/ writers problem solution. It works
New to PHP and MySQL, have heard amazing things about this website from Leo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.