Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: csv2acc.wbt ADO - TAB-delimited to MDB conversion
nVer = 2000 ; for office 97, see nVer (below) cMDB = "C:\TEMP\NEWTBL.MDB" If FileExist(cMDB) Then FileDelete( cMDB ) cPath = "C:\TEMP" cTXT = "USERS.TXT" ; first row has column names If ! FileExist( Strcat( cPath,"\",cTXT ) ) message("Unable to Continue","Missing Text File %cTXT%") Exit Endif ; on with the show BoxOpen("Updating %cMDB%","Inserting Records") If nVer == 97 ;create Office 97 compatible file cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%cMDB%;Jet OLEDB:Engine Type=4" Else cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%cMDB%" Endif If ! FileExist( cMDB ) cat = ObjectOpen("ADOX.Catalog") cat.Create(cConn) ObjectClose(cat) Endif DB = ObjectOpen("ADODB.Connection") DB.Open(cConn) cSQL = 'SELECT * INTO [USERS] FROM [TEXT;DATABASE=%cPath%;HDR=YES;FMT=Delimited].[%cTXT%];' DB.EXECUTE(cSQL) ;ok, so Table is Created RS = ObjectOpen("ADODB.Recordset") cSQL = 'SELECT USER, SUM(MINUTES) as TOTALMINUTES FROM USERS GROUP BY USER;' RS = DB.EXECUTE(cSQL) RS.MoveFirst() While ! RS.Eof() fld = RS.Fields("USER") n = fld.Value fld = RS.Fields("TOTALMINUTES") m = fld.Value Message( "User %n%","Had %m% Total Minutes" ) RS.MoveNext() EndWhile RS.Close() ObjectClose(RS) DB.Close() ObjectClose(DB) BoxShut() Exit
Article ID: W15597
File Created: 2003:05:13:11:29:10
Last Updated: 2003:05:13:11:29:10