db = "C:\Users\username\databases\employeeID.mdb"
TextExportFile = "C:\Users\username\databases\Exp.txt"

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; " & "Data Source =" & db

strSQL = "SELECT IDNumber+','+Name FROM employeeID "

rs.Open strSQL, cn, 3, 3

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(TextExportFile, True)

a = rs.GetString
f.WriteLine a
f.Close

===

db = "C:\Users\amoore19\databases\employeeID.mdb"

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Set mstream = CreateObject("ADODB.Stream")

mstream.Type = 1 ''adTypeBinary

cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; " & "Data Source =" & db

strSQL = "SELECT AimsIDNumber,photo FROM employeeID WHERE AimsIDNumber like 'A00%' and photo is not null"

rs.Open strSQL, cn

DO WHILE not rs.eof

mstream.Open
mstream.Write rs("photo")
mstream.SaveToFile "C:\images\all\" & rs("AimsIDNumber") & ".jpg", 2 ''adSaveCreateOveWrite
mstream.close
rs.movenext

Loop

===

db = "C:\Users\username\databases\employeeID.mdb"
TextExportFile = "C:\Users\username\databases\Exp.txt"

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Set mstream = CreateObject("ADODB.Stream")

mstream.Type = 1 'adTypeBinary

cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; " & "Data Source =" & db

strSQL = "SELECT IDNumber,Name FROM employeeID "

rs.Open strSQL, cn

Do Until rs.EOF
   mstream.Open
   mstream.Write rs("Name")
   mstream.SaveToFile rs("IDNumber"), 2 'adSaveCreateOveWrite
   mstream.close
   rs.MoveNext
Loop


'Set fs = CreateObject("Scripting.FileSystemObject")
'Set f = fs.CreateTextFile(TextExportFile, True)
'a = rs.GetString
'f.WriteLine a
'f.Close

+ Recent posts