Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #9974
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Neil <xxx@gmail.com> |
| Newsgroups | comp.databases.ms-access |
| Subject | Re: Copying files with VB statement |
| Date | Fri, 03 Oct 2014 16:42:35 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 37 |
| Message-ID | <542F184B.9010509@gmail.com> (permalink) |
| References | <542efc65$0$23229$edfadb0f@dtext01.news.tele.dk> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mx05.eternal-september.org; posting-host="9768a1193dc012cfc531ce57a9e79a74"; logging-data="13961"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oAlJ1zz0/DgrjD7roPvjl" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 |
| In-Reply-To | <542efc65$0$23229$edfadb0f@dtext01.news.tele.dk> |
| Cancel-Lock | sha1:MqpKl4kl1nZosWuhdNDFsF7U36o= |
| Xref | csiph.com comp.databases.ms-access:9974 |
Show key headers only | View raw
On 10/3/2014 2:44 PM, PR wrote:
> I have a database with more than 20000 records each representing a
> jpg-file (vintage Danish stereoscopic cards).
> Each record has a number of the format XY1234 and the associated file
> has the name XY1234.jpg placed in a directory …\XY\XY1234.jpg.
> When running a query e.g. pictures from “Greenland” a new table with 300
> records are generated.
> I want to take the filenames from this query and copy the files to a new
> (temporary) directory, so I can burn a CD with the files.
> Is this possible, and how would a VB statement look making the command?:
> “Copy all records from table(query “Greenland”) and paste to directory
> ….\new”
> Any suggestions?
> Peter R.
Function CopyJPGs
Dim rs as recordset
dim lng as long
Const SourceDirectory = "C:\XY\"
Const TargetDirectory = "C:\Temp\"
set rs = currentdb.openrecordset("Greenland", dbopensnapshot)
do until rs.eof
'This assumes that the field containing the number is called
'RecNo. Modify to use the actual field name.
FileCopy SourceDirectory & rs!RecNo & ".jpg", _
TargetDirectory & rs!RecNo & ".jpg"
lng = lng + 1
rs.movenext
loop
MsgBox lng & " files copied to " & TargetDirectory & ".", vbInformation
End Function
Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Copying files with VB statement "PR" <randlov_(remove this)@post9.tele.dk> - 2014-10-03 21:44 +0200
Re: Copying files with VB statement Neil <xxx@gmail.com> - 2014-10-03 16:42 -0500
Re: Copying files with VB statement "PR" <randlov_(remove this)@post9.tele.dk> - 2014-10-04 17:38 +0200
csiph-web