home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,780 of 10,840   
   Raoul Watson to All   
   Re: Import to/Export From Existing Acces   
   17 Jun 09 02:27:59   
   
   From: WatsonR@IntelligenCIA.com   
      
   JP wrote:   
   > Hi:   
   >   
   > I'm trying to import a *.csv file into an existing Access 2000 table using   
   > VB 6.0.  The *.csv file can have between 40 and 48 fields, and the table in   
   > Access 2000 has a constant 48 fields.  After I manipulate the data, it must   
   > be exported into a *.csv file and uploaded to software on the Internet.   
   >   
   > Is there an example somewhere that will show how this can be done using VB   
   > 6.0?  I've looked at the VisData example in the Samples, but it looks for a   
   > *.txt file.  I've changed the extension on the file from *.csv to *.txt, but   
   > it says that it cannot open it because it is in used by someone else, or I   
   > don't have permission to open it.  Then when I have been able to get a *.txt   
   > file open, it makes a new table... I can't have it going into a "new" table.   
   >   
   > Any advice or assistance would be deeply appreciated.   
   >   
   > Joe-Paul   
   >   
   >   
   Joe -- a .csv simply is a coma delimeted text file. The fields are   
   separated by comas, hence the name Coma-Separated-Values.   
   You will have to process each line individually and dump the contents   
   into the proper fields in the database using the update method..   
      
   For example, assuming the first input from the csv file yields   
   "Jim,Smith,1010 Any street,Any City,AZ,12345"   
      
   Extract each element and store them into the db fields   
      
   Dim temp() As String   
   ' assuming a$ is from the input file   
   temp = Split(a$, ",")   
   ' Assuming your field names in the DB   
   ' are these..   
      
   .recordset("FIRSTNAME") = temp(0)   
   .recordset("LASTTNAME") = temp(1)   
   .recordset("ADDRESS") = temp(2)   
   .recordset("CITY") = temp(3)   
   ..etc..   
      
   ' When completed   
      
   .Recordset.Update   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca