Re: Strange Problem doing DOS Dir Command in VBA Help Please



Shell is an asynchronous call. Follow Allens suggestion and use the Dir
function instead.

--
Terry Kreft
MVP Microsoft Access


"Bugs" <bugs007@xxxxxxxxxxxxxxx> wrote in message
news:430da914$0$19501$afc38c87@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Everyone.
>
> This problem is driving me crazy.
>
> Im using Access2003.
>
> Basically what I wish to do is create a new record for each jpg bmp or gif
> file in the current directory.
>
> I need to just save the path and filename of each file in a table in its
own
> record
>
> I am trying to do a DOS command to do a DIR of jpg, bmp and gif files, and
> save the output to a file C:\Filelist.txt
> using the following line.
>
> Shell (Environ$("COMSPEC") & " /c Dir *.jpg *.bmp *.gif /S /B >
> C:\Filelist.txt")
>
> I then try to read that file into the Imagepath field with VBA doing the
> following:
>
> Dim Q as string
>
> Open "C:\Filelist.txt" For Input As #1
>
> While Not EOF(1)
>
> DoCmd.GoToRecord , , acNewRec
> Line Input #1, Q
> Imagepath = Q
>
>
> Wend
>
> Close#1
>
>
>
> Works OK first time used, creates a set of new records, one for each jpg
bmp
> and gif file in the directory. Bewdy.
>
> But on second and subsequent uses (and a change of the current directory)
it
> creates a duplicate of the previously created set of records instead of
the
> contents of C:\Filelist.txt (ie Pass1 creates records OK, Pass2 creates
same
> records as Pass1, Pass3 creates same records as pass2 etc)
>
> I checked C:\Filelist.txt and it has been created successfully each time
>
> Yet VBA reads its contents incorrectly. Seems to ignore the fact that
> C:\Filelist.txt has been overwritten.Always seems to
> be one pass behind.
>
> I have even tried using a macro to import C:\Filelist.txt as a table and
do
> an append query but same problem.
>
> The behaviour of C:\Filelist.txt is odd.
>
>
> Any help would be extremely appreciated.
>
>
> Thank you.
>
> Joe.
>
>
>


.



Relevant Pages

  • Re: Image quality on form is poor
    ... I just checked and "Windows Picture and Fax Viewer" is the registered ... program for BMP, JPG, GIF files. ...
    (microsoft.public.access.forms)
  • Re: Strange Problem doing DOS Dir Command in VBA Help Please
    ... >> I am trying to do a DOS command to do a DIR of jpg, bmp and gif files, ... >> Joe. ...
    (comp.databases.ms-access)
  • Re: Strange Problem doing DOS Dir Command in VBA Help Please
    ... > Basically what I wish to do is create a new record for each jpg bmp or gif ... > I am trying to do a DOS command to do a DIR of jpg, bmp and gif files, and ... > I then try to read that file into the Imagepath field with VBA doing the ...
    (comp.databases.ms-access)
  • RE: stego and executable files
    ... Hiding executables in the JPEG implies that whatever you use to read the ... to demostrate on JPG and BMP picture formates, ... Now to the structure of BMP files. ... Now JPG has structure more suitable for storage, ...
    (Security-Basics)
  • Re: jpg and bmp conflick
    ... today's larger HDs the cache is unnecessarily large. ... jeff's WebLog why IE will only let you save as BMP: ... Lately when I right click a jpg image file like a news photo on the ... As before can't pinpoint when it will or will not do this also. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)