VBA Make Access wait API is not working

Dear All

The API: Shell and Wait, by Terry Kreft is not working to me

http://www.mvps.org/access/api/api0004.htm

I know I can not post the API by Terry Kreft, but I can post what
changes I did in the original API
------
Function ShellWait(Pathname As String, Optional WindowStyle As Long)
End Function
-----

This is my code in a module

'Initialize New Event Make_Access_Wait
    'Make Access wait till It is done with other application
    MsgBox "Rutina ShellWait"
    Call ShellWait("C:\Program Files\Dups\Batch Files\HashIt.bat")

I really need to Access wait till I'm done with my other application.
But due is not working I had to add another API

API: Make code go to Sleep by by Dev Ashish

http://www.mvps.org/access/api/api0021.htm


'Implement a wait period in Access where the duration can be
    'increased/decreased bychanging the constant to a corressponding
higher/lower value
    MsgBox "Rutina sSleep"
    Call sSleep(9000)

This API is working fine, the problem is the code does a hash in
different directories, some of them with a lot of files to hash,
others with a few

In this way if the user selects a directory with few files to hash the
user has to wait 9000 milliseconds. In other hands if the user selects
a directory with a lot of files also he has to wait the same time, but
some directories could take more than 1 hour to complete the entire
process

I don not want to use the API: Make code go to Sleep by Dev Ashish for
this reason, and I do know what I its wrong with the API by Terry
Kreft or why is not working for my code

I first want to know why the API by Terry Kreft is not working for me,
and if there is another alternative to make Access wait till the
entire process ends.
Thanks in advance for any help
Regards,
Antonio Macias
0
rebelscum0000
3/17/2008 8:04:26 PM
access 16762 articles. 3 followers. Follow

5 Replies
905 Views

Similar Articles

[PageSpeed] 26

What's the code in your batch file? If your batch file is, say, firing off 
other batch files, the API won't know anything about them.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"rebelscum0000" <piiixp@jedikeeper.com> wrote in message 
news:cdef2faf-2db7-4fee-a158-eb6518e70d01@s13g2000prd.googlegroups.com...
>
> I first want to know why the API by Terry Kreft is not working for me,
> and if there is another alternative to make Access wait till the
> entire process ends.


0
Douglas
3/17/2008 9:34:34 PM
Hi Douglas, good to read you as always

> What's the code in your batch file?

My batch file contains

CD /D "C:\Program Files\CDCheck"
START /WAIT CDCheck /CRC:MD5 "C:\Downloads" /O:"C:\Downloads
\Downloads.CRC" /SaveReport:"C:\Downloads\Downloads Report.txt"

The codes create a MS-DOS Batch File:
'Writing out a batch file (.bat or .vbs) using VBA
I Call this file called HashIt.bat
If I does  not make Access wait to finish the task of the .bat file,
the results are; incomplete file .CRC and Report.txt and executing the
next VBA statement.

Please help
Thanks in advance
Regards,
Antonio Macias

My entire code is

Sub OpenWinBrowse()
Dim MyDlg As New DialogClass 'Common Dialogs Class Module for Access
and VBA
Dim vArr As Variant
Dim MyDigResponse As Integer
Dim j As Integer
Dim itemCount As Integer
Dim MyCodeSelection As Integer
Dim GetFolder As String
Dim strDrive As String
Dim FirstFolder As String
Dim LastFolder As String
Dim strItems As String
Dim TempCRCFile As String
Dim TempTXTFile As String
Dim strDir As String
Dim strVerify As String
Dim newDirectory As String
Dim ccgFF As Integer
Dim egfFF As Integer
Dim amcFF As Integer

'References:
'Microsoft DA0 3.6 Object Runtime

    'Opens the Browse Dialog
    With MyDlg
      .TypeFile = 0  'All file Types
      .TypeFile = 4  'Text Files
      .DialogType = "Browse"
    End With

    'Show the select type of dialog selected with the properties
desired
    MyDlg.Show

    'Waits for the user to click a button, and returns an Integer
indicating which button
    'the user clicked .DialogType = "Browse"
    MyDigResponse = Len(MyDlg.ReturnFilePath)

        If MyDigResponse = 0 Then
            'User chose Cancel.
            MsgBox "User Cancelled", vbExclamation, "Browse"
            End
        Else
            'User Chose OK.
        End If

    'The name for the chosen file or directory
    'Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder\Folder..
    GetFolder = MyDlg.ReturnFilePath
    Debug.Print "GetFolder = " & GetFolder

    'Initialize New Event Split_GetFolder
    'Splits The Folders in GetFolder
    'Initialize Variables
    vArr = Split(GetFolder, "\")

    For j = 0 To UBound(vArr)
        'Folders in the string separated by { \ }
        If Len(vArr(j)) > 0 Then
            strItems = strItems & vArr(j) & vbCr
            'Debug.Print strItems
            itemCount = itemCount + 1
        End If
    Next

    Debug.Print "there are " & itemCount & " Items in this string" &
vbCr & strItems

    'Manage Drive and Folders OF GetFolder
    '<Drive>
    strDrive = Left(vArr(0), 1)
    Debug.Print "Drive = " & strDrive
    'First Folder
    FirstFolder = vArr(1)
    Debug.Print "First Folder = " & FirstFolder
    'Last Folder
    LastFolder = vArr(itemCount - 1)
    Debug.Print "Last Folder = " & LastFolder

    'Start Event Selection_Drive_Folders
    'Determine IF is <Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder
\Folder...
    If itemCount = 1 Then

        Debug.Print "Is <Drive>:\"
        MyCodeSelection = 1
        TempCRCFile = GetFolder & strDrive & " Temp" & ".CRC"
        TempTXTFile = GetFolder & strDrive & " Report" & ".txt"
        strDir = GetFolder & strDrive & ".CRC" 'Esto para que era?
        strVerify = GetFolder & strDrive & " Verification" & ".txt"
'Esto para que era?

    ElseIf itemCount = 2 Then

        Debug.Print "IS <Drive>:\Folder"
        MyCodeSelection = 2
        TempCRCFile = GetFolder & "\" & FirstFolder & " Temp" & ".CRC"
        TempTXTFile = GetFolder & "\" & FirstFolder & " Report" &
".txt"
        strDir = GetFolder & "\" & FirstFolder & ".CRC" 'Esto para que
era?
        strVerify = GetFolder & "\" & FirstFolder & " Verification" &
".txt" 'Esto para que era?

    ElseIf itemCount >= 3 Then

        Debug.Print "IS <Drive>:\Folder\Folder..."
        MyCodeSelection = 3
        TempCRCFile = GetFolder & "\" & strDrive & " " & FirstFolder &
" TO " & LastFolder & " Temp" & ".CRC"
        TempTXTFile = GetFolder & "\" & strDrive & " " & FirstFolder &
" TO " & LastFolder & " Report" & ".txt"
        strDir = GetFolder & "\" & strDrive & " " & FirstFolder & " TO
" & LastFolder & ".CRC" 'Esto para que era?
        strVerify = GetFolder & "\" & strDrive & " " & FirstFolder & "
TO " & LastFolder & " Verification" & ".txt" 'Esto para que era?
        Debug.Print strVerify

    End If

    Debug.Print "MyCodeSelection = " & MyCodeSelection

    'Initialize New Event API_File_Exists
    'API FileExists: Returns True of False If a File Exists
    'IF FileExists = True Then Kill

    If FileExists(TempCRCFile) = True Then
        Debug.Print "File Exists: = True"
        '<Drive>:\<Drive> Temp.CRC OR
        '<Drive>\Folder\FirstFolder Temp.CRC OR
        '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
Temp.CRC
        Kill (TempCRCFile)
    Else
        Debug.Print "File Exists: = False"
    End If

    If FileExists(TempTXTFile) = True Then
            Debug.Print "File Exists: = True"
            '<Drive>:\<Drive> Report.txt OR
            '<Drive>\Folder\FirstFolder Report.txt OR
            '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO
LastFolder Report.txt
            Kill (TempTXTFile)
    Else
            Debug.Print "File Exists: = False"
    End If

    If FileExists(strVerify) = True Then
            Debug.Print "File Exists: = True"
            '<Drive>:\<Drive> Report.txt OR
            '<Drive>\Folder\FirstFolder Report.txt OR
            '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO
LastFolder Report.txt
            Kill (strVerify)
    Else
            Debug.Print "File Exists: = False"
    End If

    If FileExists("C:\Program Files\Dups\Batch Files\HashIt.bat") =
True Then
            Debug.Print "Batch File Exists: = True"
            Kill ("C:\Program Files\Dups\Batch Files\HashIt.bat")
    Else
            Debug.Print "Batch File Exists: = False"
    End If

    'Initialize New Event Writing_out_Temporal_CRC_File
    'Initialize Variables

        ccgFF = FreeFile()

    'Writing out a Temporal .CRC file:
    '<Drive>:\<Drive> Temp.CRC OR
    '<Drive>\Folder\FirstFolder Temp.CRC OR
    '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
Temp.CRC
    'In order to add this file into the Hash File without user
intervention (Writing out a Temporal batch file)

        Open TempCRCFile For Output As #ccgFF
        Close #ccgFF   ' Close file

    'Initialize New Event Writing_out_Temporal_Report_TXT_File
    'Initialize Variables

        egfFF = FreeFile()

    'Writing out a Temporal Report TXT file:
    '<Drive>:\<Drive> Report.txt OR
    '<Drive>\Folder\FirstFolder Report.txt OR
    '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
Report.txt
    'In order to add this file into the Hash File without user
intervention (Writing out a Temporal batch file)

        Open TempTXTFile For Output As #egfFF
        Print #egfFF, "============ 00/00/0000 00:00:00 AM/PM
============"
        Print #egfFF, "-- Results --"
        Print #egfFF, "Info"
        Print #egfFF, "- date: 00/00/0000"
        Print #egfFF, "- process: Hash"
        Print #egfFF, "- source: <Drive>:\<Folder>"
        Print #egfFF, "- source volume label: Volume Name"
        Print #egfFF, ' Write blank line.
        Print #egfFF, "Basic statistics"
        Print #egfFF, "- time elapsed: 00:00:00"
        Print #egfFF, "- overall transfer [kB/s]:
000000000000,000000000000"
        Print #egfFF, "- folders processed: 000000000000"
        Print #egfFF, "- files processed: 00000000000000"
        Print #egfFF, "- source bytes read: 000000000000 MB
(000000000000,000000000000,000000000000 bytes)"
        Print #egfFF, "- source average transfer [kB/s]:
000000000000,000000000000"
        Print #egfFF, "- source clean   transfer [kB/s]:
000000000000,000000000000"
        Print #egfFF, ' Write blank line.
        Print #egfFF, "Errors"
        Print #egfFF, "- errors: 000000000000"
        Print #egfFF, "- warnings: 0000000000"
        Print #egfFF, "- other: 0000000000000"
        Print #egfFF, ' Write blank line.
        Print #egfFF, "-- Messages --"
        Print #egfFF, "note;hash;Hash file created (code:
0000000000000);<Drive>:\<Folder>:\File.CRC"
        Print #egfFF, "note;hash;Hash file created (code:
0000000000000);<Drive>:\<Folder>:\File.CRC"
        Print #egfFF, "note;hash;Hash file created (code:
0000000000000);<Drive>:\<Folder>:\File.CRC"
        Close #egfFF   ' Close file.

    'Initialize New Event
API_Folder_Exists_And_CreateDirectory_Nested_Folders
    'API Folder Exists
    'Checks IF the Folder exists, IF NOT THEN create it
    If FolderExists("C:\Program Files\Dups\Batch Files") = True Then
        'Folder exists
        Debug.Print "Folder Exists"
    Else
        'API CreateDirectory Nested Folders
        'Folder does not exist
        MsgBox "Folder Does not exits"
        newDirectory = "C:\Program Files\Dups\Batch Files"
        CreateNestedFoldersByPath (newDirectory)
        Debug.Print "Folder Does not Exists"
    End If

    'Initialize New Event Writing_out_batch_file_CDCheck
    'Initialize Variables

    amcFF = FreeFile()

    'Writing out a batch file (.bat or .vbs) using VBA
    'Working and Tested Solution
    'Determine IF is <Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder
\Folder...
    'Please note: Very Sensitive if the user opens a file the hash
change
    If MyCodeSelection = 1 Then

         Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For
Output As #amcFF
            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
& "\CDCheck" & Chr(34)
            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
GetFolder & Chr(34) & Chr(32) & _
            "/O:" & Chr(34) & GetFolder & strDrive & ".CRC" & Chr(34)
& Chr(32) & _
            "/SaveReport:" & Chr(34) & GetFolder & strDrive & "
Report" & ".txt" & Chr(34)
        Close #amcFF

    ElseIf MyCodeSelection = 2 Then

        Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For Output
As #amcFF
            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
& "\CDCheck" & Chr(34)
            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
GetFolder & Chr(34) & Chr(32) & _
            "/O:" & Chr(34) & GetFolder & "\" & FirstFolder & ".CRC" &
Chr(34) & Chr(32) & _
            "/SaveReport:" & Chr(34) & GetFolder & "\" & FirstFolder &
" Report" & ".txt" & Chr(34)
        Close #amcFF

    ElseIf MyCodeSelection = 3 Then

        Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For Output
As #amcFF
            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
& "\CDCheck" & Chr(34)
            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
GetFolder & Chr(34) & Chr(32) & _
            "/O:" & Chr(34) & GetFolder & "\" & strDrive & " " &
FirstFolder & " TO " & LastFolder & _
            ".CRC" & Chr(34) & Chr(32) & _
            "/SaveReport:" & Chr(34) & GetFolder & "\" & strDrive & "
" & FirstFolder & " TO " & _
            LastFolder & " Report" & ".txt" & Chr(34)
        Close #amcFF

    End If

    Debug.Print "MyCodeSelection = " & MyCodeSelection

    MsgBox "Termine el Hash"

    'Initialize New Event Make_Access_Wait
    'Make Access wait till It is done with other application
    MsgBox "Rutina ShellWait"
    Call ShellWait("C:\Program Files\Dups\Batch Files\HashIt.bat")
    'Implement a wait period in Access where the duration can be
    'increased/decreased bychanging the constant to a corressponding
higher/lower value
    MsgBox "Rutina sSleep"
    Call sSleep(9000)

    Next VBA statment <----

    End Sub
0
rebelscum0000
3/17/2008 11:11:32 PM
See what happens if you use

Dim strStatement As String

  strStatement = """C:\Program Files\CDCheckCDCheck"" /CRC:MD5 " & _
    """C:\Downloads"" /O:""C:\Downloads\Downloads.CRC"" " & _
    " /SaveReport:""C:\Downloads\Downloads Report.txt"""

  Call ShellWait(strStatement)

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"rebelscum0000" <piiixp@jedikeeper.com> wrote in message 
news:a5b061e5-af15-4ef9-a8f7-8bc410cbf3d9@s8g2000prg.googlegroups.com...
> Hi Douglas, good to read you as always
>
>> What's the code in your batch file?
>
> My batch file contains
>
> CD /D "C:\Program Files\CDCheck"
> START /WAIT CDCheck /CRC:MD5 "C:\Downloads" /O:"C:\Downloads
> \Downloads.CRC" /SaveReport:"C:\Downloads\Downloads Report.txt"
>
> The codes create a MS-DOS Batch File:
> 'Writing out a batch file (.bat or .vbs) using VBA
> I Call this file called HashIt.bat
> If I does  not make Access wait to finish the task of the .bat file,
> the results are; incomplete file .CRC and Report.txt and executing the
> next VBA statement.
>
> Please help
> Thanks in advance
> Regards,
> Antonio Macias
>
> My entire code is
>
> Sub OpenWinBrowse()
> Dim MyDlg As New DialogClass 'Common Dialogs Class Module for Access
> and VBA
> Dim vArr As Variant
> Dim MyDigResponse As Integer
> Dim j As Integer
> Dim itemCount As Integer
> Dim MyCodeSelection As Integer
> Dim GetFolder As String
> Dim strDrive As String
> Dim FirstFolder As String
> Dim LastFolder As String
> Dim strItems As String
> Dim TempCRCFile As String
> Dim TempTXTFile As String
> Dim strDir As String
> Dim strVerify As String
> Dim newDirectory As String
> Dim ccgFF As Integer
> Dim egfFF As Integer
> Dim amcFF As Integer
>
> 'References:
> 'Microsoft DA0 3.6 Object Runtime
>
>    'Opens the Browse Dialog
>    With MyDlg
>      .TypeFile = 0  'All file Types
>      .TypeFile = 4  'Text Files
>      .DialogType = "Browse"
>    End With
>
>    'Show the select type of dialog selected with the properties
> desired
>    MyDlg.Show
>
>    'Waits for the user to click a button, and returns an Integer
> indicating which button
>    'the user clicked .DialogType = "Browse"
>    MyDigResponse = Len(MyDlg.ReturnFilePath)
>
>        If MyDigResponse = 0 Then
>            'User chose Cancel.
>            MsgBox "User Cancelled", vbExclamation, "Browse"
>            End
>        Else
>            'User Chose OK.
>        End If
>
>    'The name for the chosen file or directory
>    'Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder\Folder..
>    GetFolder = MyDlg.ReturnFilePath
>    Debug.Print "GetFolder = " & GetFolder
>
>    'Initialize New Event Split_GetFolder
>    'Splits The Folders in GetFolder
>    'Initialize Variables
>    vArr = Split(GetFolder, "\")
>
>    For j = 0 To UBound(vArr)
>        'Folders in the string separated by { \ }
>        If Len(vArr(j)) > 0 Then
>            strItems = strItems & vArr(j) & vbCr
>            'Debug.Print strItems
>            itemCount = itemCount + 1
>        End If
>    Next
>
>    Debug.Print "there are " & itemCount & " Items in this string" &
> vbCr & strItems
>
>    'Manage Drive and Folders OF GetFolder
>    '<Drive>
>    strDrive = Left(vArr(0), 1)
>    Debug.Print "Drive = " & strDrive
>    'First Folder
>    FirstFolder = vArr(1)
>    Debug.Print "First Folder = " & FirstFolder
>    'Last Folder
>    LastFolder = vArr(itemCount - 1)
>    Debug.Print "Last Folder = " & LastFolder
>
>    'Start Event Selection_Drive_Folders
>    'Determine IF is <Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder
> \Folder...
>    If itemCount = 1 Then
>
>        Debug.Print "Is <Drive>:\"
>        MyCodeSelection = 1
>        TempCRCFile = GetFolder & strDrive & " Temp" & ".CRC"
>        TempTXTFile = GetFolder & strDrive & " Report" & ".txt"
>        strDir = GetFolder & strDrive & ".CRC" 'Esto para que era?
>        strVerify = GetFolder & strDrive & " Verification" & ".txt"
> 'Esto para que era?
>
>    ElseIf itemCount = 2 Then
>
>        Debug.Print "IS <Drive>:\Folder"
>        MyCodeSelection = 2
>        TempCRCFile = GetFolder & "\" & FirstFolder & " Temp" & ".CRC"
>        TempTXTFile = GetFolder & "\" & FirstFolder & " Report" &
> ".txt"
>        strDir = GetFolder & "\" & FirstFolder & ".CRC" 'Esto para que
> era?
>        strVerify = GetFolder & "\" & FirstFolder & " Verification" &
> ".txt" 'Esto para que era?
>
>    ElseIf itemCount >= 3 Then
>
>        Debug.Print "IS <Drive>:\Folder\Folder..."
>        MyCodeSelection = 3
>        TempCRCFile = GetFolder & "\" & strDrive & " " & FirstFolder &
> " TO " & LastFolder & " Temp" & ".CRC"
>        TempTXTFile = GetFolder & "\" & strDrive & " " & FirstFolder &
> " TO " & LastFolder & " Report" & ".txt"
>        strDir = GetFolder & "\" & strDrive & " " & FirstFolder & " TO
> " & LastFolder & ".CRC" 'Esto para que era?
>        strVerify = GetFolder & "\" & strDrive & " " & FirstFolder & "
> TO " & LastFolder & " Verification" & ".txt" 'Esto para que era?
>        Debug.Print strVerify
>
>    End If
>
>    Debug.Print "MyCodeSelection = " & MyCodeSelection
>
>    'Initialize New Event API_File_Exists
>    'API FileExists: Returns True of False If a File Exists
>    'IF FileExists = True Then Kill
>
>    If FileExists(TempCRCFile) = True Then
>        Debug.Print "File Exists: = True"
>        '<Drive>:\<Drive> Temp.CRC OR
>        '<Drive>\Folder\FirstFolder Temp.CRC OR
>        '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
> Temp.CRC
>        Kill (TempCRCFile)
>    Else
>        Debug.Print "File Exists: = False"
>    End If
>
>    If FileExists(TempTXTFile) = True Then
>            Debug.Print "File Exists: = True"
>            '<Drive>:\<Drive> Report.txt OR
>            '<Drive>\Folder\FirstFolder Report.txt OR
>            '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO
> LastFolder Report.txt
>            Kill (TempTXTFile)
>    Else
>            Debug.Print "File Exists: = False"
>    End If
>
>    If FileExists(strVerify) = True Then
>            Debug.Print "File Exists: = True"
>            '<Drive>:\<Drive> Report.txt OR
>            '<Drive>\Folder\FirstFolder Report.txt OR
>            '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO
> LastFolder Report.txt
>            Kill (strVerify)
>    Else
>            Debug.Print "File Exists: = False"
>    End If
>
>    If FileExists("C:\Program Files\Dups\Batch Files\HashIt.bat") =
> True Then
>            Debug.Print "Batch File Exists: = True"
>            Kill ("C:\Program Files\Dups\Batch Files\HashIt.bat")
>    Else
>            Debug.Print "Batch File Exists: = False"
>    End If
>
>    'Initialize New Event Writing_out_Temporal_CRC_File
>    'Initialize Variables
>
>        ccgFF = FreeFile()
>
>    'Writing out a Temporal .CRC file:
>    '<Drive>:\<Drive> Temp.CRC OR
>    '<Drive>\Folder\FirstFolder Temp.CRC OR
>    '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
> Temp.CRC
>    'In order to add this file into the Hash File without user
> intervention (Writing out a Temporal batch file)
>
>        Open TempCRCFile For Output As #ccgFF
>        Close #ccgFF   ' Close file
>
>    'Initialize New Event Writing_out_Temporal_Report_TXT_File
>    'Initialize Variables
>
>        egfFF = FreeFile()
>
>    'Writing out a Temporal Report TXT file:
>    '<Drive>:\<Drive> Report.txt OR
>    '<Drive>\Folder\FirstFolder Report.txt OR
>    '<Drive>:\Folder\Folder...\<Drive> FirstFolder TO LastFolder
> Report.txt
>    'In order to add this file into the Hash File without user
> intervention (Writing out a Temporal batch file)
>
>        Open TempTXTFile For Output As #egfFF
>        Print #egfFF, "============ 00/00/0000 00:00:00 AM/PM
> ============"
>        Print #egfFF, "-- Results --"
>        Print #egfFF, "Info"
>        Print #egfFF, "- date: 00/00/0000"
>        Print #egfFF, "- process: Hash"
>        Print #egfFF, "- source: <Drive>:\<Folder>"
>        Print #egfFF, "- source volume label: Volume Name"
>        Print #egfFF, ' Write blank line.
>        Print #egfFF, "Basic statistics"
>        Print #egfFF, "- time elapsed: 00:00:00"
>        Print #egfFF, "- overall transfer [kB/s]:
> 000000000000,000000000000"
>        Print #egfFF, "- folders processed: 000000000000"
>        Print #egfFF, "- files processed: 00000000000000"
>        Print #egfFF, "- source bytes read: 000000000000 MB
> (000000000000,000000000000,000000000000 bytes)"
>        Print #egfFF, "- source average transfer [kB/s]:
> 000000000000,000000000000"
>        Print #egfFF, "- source clean   transfer [kB/s]:
> 000000000000,000000000000"
>        Print #egfFF, ' Write blank line.
>        Print #egfFF, "Errors"
>        Print #egfFF, "- errors: 000000000000"
>        Print #egfFF, "- warnings: 0000000000"
>        Print #egfFF, "- other: 0000000000000"
>        Print #egfFF, ' Write blank line.
>        Print #egfFF, "-- Messages --"
>        Print #egfFF, "note;hash;Hash file created (code:
> 0000000000000);<Drive>:\<Folder>:\File.CRC"
>        Print #egfFF, "note;hash;Hash file created (code:
> 0000000000000);<Drive>:\<Folder>:\File.CRC"
>        Print #egfFF, "note;hash;Hash file created (code:
> 0000000000000);<Drive>:\<Folder>:\File.CRC"
>        Close #egfFF   ' Close file.
>
>    'Initialize New Event
> API_Folder_Exists_And_CreateDirectory_Nested_Folders
>    'API Folder Exists
>    'Checks IF the Folder exists, IF NOT THEN create it
>    If FolderExists("C:\Program Files\Dups\Batch Files") = True Then
>        'Folder exists
>        Debug.Print "Folder Exists"
>    Else
>        'API CreateDirectory Nested Folders
>        'Folder does not exist
>        MsgBox "Folder Does not exits"
>        newDirectory = "C:\Program Files\Dups\Batch Files"
>        CreateNestedFoldersByPath (newDirectory)
>        Debug.Print "Folder Does not Exists"
>    End If
>
>    'Initialize New Event Writing_out_batch_file_CDCheck
>    'Initialize Variables
>
>    amcFF = FreeFile()
>
>    'Writing out a batch file (.bat or .vbs) using VBA
>    'Working and Tested Solution
>    'Determine IF is <Drive>:\ OR <Drive>:\Folder OR <Drive>:\Folder
> \Folder...
>    'Please note: Very Sensitive if the user opens a file the hash
> change
>    If MyCodeSelection = 1 Then
>
>         Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For
> Output As #amcFF
>            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
> & "\CDCheck" & Chr(34)
>            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
> GetFolder & Chr(34) & Chr(32) & _
>            "/O:" & Chr(34) & GetFolder & strDrive & ".CRC" & Chr(34)
> & Chr(32) & _
>            "/SaveReport:" & Chr(34) & GetFolder & strDrive & "
> Report" & ".txt" & Chr(34)
>        Close #amcFF
>
>    ElseIf MyCodeSelection = 2 Then
>
>        Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For Output
> As #amcFF
>            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
> & "\CDCheck" & Chr(34)
>            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
> GetFolder & Chr(34) & Chr(32) & _
>            "/O:" & Chr(34) & GetFolder & "\" & FirstFolder & ".CRC" &
> Chr(34) & Chr(32) & _
>            "/SaveReport:" & Chr(34) & GetFolder & "\" & FirstFolder &
> " Report" & ".txt" & Chr(34)
>        Close #amcFF
>
>    ElseIf MyCodeSelection = 3 Then
>
>        Open "C:\Program Files\Dups\Batch Files\HashIt.bat" For Output
> As #amcFF
>            Print #amcFF, "CD /D " & Chr(34) & Environ("ProgramFiles")
> & "\CDCheck" & Chr(34)
>            Print #amcFF, "START /WAIT CDCheck /CRC:MD5 " & Chr(34) &
> GetFolder & Chr(34) & Chr(32) & _
>            "/O:" & Chr(34) & GetFolder & "\" & strDrive & " " &
> FirstFolder & " TO " & LastFolder & _
>            ".CRC" & Chr(34) & Chr(32) & _
>            "/SaveReport:" & Chr(34) & GetFolder & "\" & strDrive & "
> " & FirstFolder & " TO " & _
>            LastFolder & " Report" & ".txt" & Chr(34)
>        Close #amcFF
>
>    End If
>
>    Debug.Print "MyCodeSelection = " & MyCodeSelection
>
>    MsgBox "Termine el Hash"
>
>    'Initialize New Event Make_Access_Wait
>    'Make Access wait till It is done with other application
>    MsgBox "Rutina ShellWait"
>    Call ShellWait("C:\Program Files\Dups\Batch Files\HashIt.bat")
>    'Implement a wait period in Access where the duration can be
>    'increased/decreased bychanging the constant to a corressponding
> higher/lower value
>    MsgBox "Rutina sSleep"
>    Call sSleep(9000)
>
>    Next VBA statment <----
>
>    End Sub 


0
Douglas
3/18/2008 12:19:54 AM
HI, Doug

I Found that if I changed

Call ShellWait("C:\Program Files\Dups\Batch Files\HashIt.bat")  for :

Call ShellWait("cmd.exe /c ""C:\Program Files\Dups\Batch Files
\HashIt.bat""")

The API: Shell and Wait, by Terry Kreft now is working and I do not
need anymore The API: Make code go to Sleep by by Dev Ashish,
that is what I wanted

Thank you very much for your help!
Regards
Antonio Macias



0
rebelscum0000
3/22/2008 11:25:52 AM
Just in case you've got users with old operating systems, it's probably 
better to use

Call ShellWait(Environ("ComSpec") & " /c ""C:\Program Files\Dups\Batch 
Files\HashIt.bat""")

(in some operating systems, you'd need

Call ShellWait("command.exe /c ""C:\Program Files\Dups\Batch 
Files\HashIt.bat""")

The ComSpec environment  variable should indicate the correct one to use.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"rebelscum0000" <piiixp@jedikeeper.com> wrote in message 
news:a7d0c37a-d4c2-430d-b608-7778e36d80e2@i12g2000prf.googlegroups.com...
> HI, Doug
>
> I Found that if I changed
>
> Call ShellWait("C:\Program Files\Dups\Batch Files\HashIt.bat")  for :
>
> Call ShellWait("cmd.exe /c ""C:\Program Files\Dups\Batch Files
> \HashIt.bat""")
>
> The API: Shell and Wait, by Terry Kreft now is working and I do not
> need anymore The API: Make code go to Sleep by by Dev Ashish,
> that is what I wanted
>
> Thank you very much for your help!
> Regards
> Antonio Macias
>
>
> 

0
Douglas
3/22/2008 2:26:13 PM
Reply:

Similar Artilces:

VBA code to say Yes or No if any VBA code is present in ActiveWork
Using XL 2003 & 97 Would like hit Ctrl+Shift+V and have an answer either yes or no as to the presence of Any VBA code in the Active Workbook. I do know that about the VBA editor/Explorer or to press the Run Macro button and get a list from various sources . I would like to stay at the keyboard and process a series of macros including one to let me know if I even need to evoke the VBA explorer. TIA Dennis There is no bootstrap macro to tell you whether you have macros or not. If there were there would be no limit to virus writers. --- HTH, David McRitchie, Microsoft MVP - Excel ...

SQL Not Working
What is wrong with this SQL? I am trying to use a Median function and trying to have the median calculate for each JobCode. SELECT tEmployeeMasterCopy.JobCode, (SELECT Median("tEmployeeMasterCopy","HourlyRate") FROM tEmployeeMasterCopy as M1 WHERE M1.JobCode = tEmployeeMasterCopy.JobCode) AS MedianByJobCode FROM tEmployeeMasterCopy GROUP BY tEmployeeMasterCopy.JobCode; Thanks in advance. It seems that (SELECT Median("tEmployeeMasterCopy","HourlyRate") FROM tEmployeeMasterCopy as M1 WHERE M1.JobCode = tEmployeeMasterCopy.JobCode) ...

Can I make child frame dock to main frame in MDI?
Hi. I have a question. I want to make child frame dock to main frame without maximization in MDI. For example, in Visual Studio 2008's case, Class View pane is splitted between classes and member functions. But, CSplitterWnd works on CFrameWnd. right? So, I guess Class View pane in Visual Studio 2008 is a CFrameWnd. Then, I don't know how to make child frame dock to main frame. On Feb 1, 11:22=A0am, MuMbi <Mu...@discussions.microsoft.com> wrote: > Hi. > > I have a question. > > I want to make child frame dock to main frame without max...

Use VBA to update Access table or Query from Excel
Can I use VBA to update Access table or Query from Excel? Thanks in advance Hi Leungkong, > Can I use VBA to update Access table or Query from Excel? Of course, using ADO or DAO. See: http://www.erlandsendata.no/english/index.php?d=envbadacexportado Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Hi Jan, Thanks. I think ADO is what I want. But I am not only want to export from excel to access. I want to edit some data in access table. For example, Access has a table "ProductList" I want to use Excel to call the product by "Pro...

Hyperlinks that I recieve in e-mails don't work in outlook 2003
LMT <LMT@discussions.microsoft.com> wrote: <nothing> Ask your question in the body of the message, not the subject. If you're using Internet Explorer, try this: click Tools>Internet Options>Programs>Reset Web Settings -- Brian Tillman "Brian Tillman" wrote Thanks Brian worked great. LMT > LMT <LMT@discussions.microsoft.com> wrote: > <nothing> > > Ask your question in the body of the message, not the subject. > > If you're using Internet Explorer, try this: click Tools>Internet > Options>...

Print, Merged Cells, and VBA
Hello I'm looking for a code that will help me with a print job for a worksheet. There are a lot of merged cells and a lot of "IF"s to be used in the VBA for range selection. Thanks in advance, Sarr ...

Access 2007 closes without updating recordsource
Greetings: If I change the recordsource for a form using the query design grid in Access 2007, and then click on the top "X" to immediately attempt to close Access, a popup asks if I wish to save the changes to the recordset. If I select "Yes", the pop-up closes, and Access itself closes, but the changes in the recordsource are not saved. If I change the recordsoure, then close the query design window, clicking "Yes" to accept the changes to the recordsource, I return to the design view of the form. If I then click to immediately attempt to close Access, t...

VBA and Scheduled task in Outlook
Hi, how can I: a) pull the query from somewhere and send it by e-mail automatically. E.g. I want to take a temperature table from http://www.wunderground.com/history/airport/EHAM/2009/7/10/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA where 2009/7/10 is the date of yesterday put it into an e-mail and send it automatically each day at 8 o'clock? b) if this is not possible, how can I send an e-mail with the attachment c:\Documents\query20090710.xls each day at 8 o'clock? my boss wants this automatized, I know how to write the VBA code for Excel, but don'...

2007 search not working with Vista with new profile
It stopped working after I deleted my mail profile and started from scratch again. Who would have guessed doing that would break the search feature? I thought maybe it was indexing, but this is even after indexing has finished. Take any word from any subject line in any message and put that same word into the search box and it doesn't find the message. Using Vista with Outlook 2007 with Exchange 2003. Also the desktop search no longer looks inside my emails. Any ideas? Is there a cheat to make Outlook 2007 use the old simple search feature we love/hate from Outlook 2003 and befor...

vba select field
Hi, having a button on a form, is it possible to select only some fields (all from the same table) of the current record instead of all fields? I've tried this code: RunCommand acCmdSelectRecord RunCommand acCmdCopy Forse dipende dei dati nel record. but it selects ALL fields in the form. Thank you. Remigio hi, On 10.04.2010 18:01, remigio wrote: > having a button on a form, is it possible to select only some fields > (all from the same table) of the current record instead of all fields? > I've tried this code: > > RunCommand acCmdSelectRecord &...

MS Access and Sql Server
Hello all, I am new to SQL server and am having some problems with Access and connecting to it. I have read so many articles but have found not one that spells it out in pure english! Hoping someone can help? OK, I just built a new machine, bought all sorts of software, and now I am ready to go. I have previously been just using MS Access 2003 / 2007 but now I want to store my tables and quarys in SQL Server. I have SQL server 2008 and 2005, I also have visual studio 2008 along with my MS access 2003 / 2007. So far I cannot get a file to connect to my SQL Server. How on earth does o...

JTDS support for shared memory access
Can anyone tell me if JTDS supports shared memory access? I would like to access the DB with TCP and Named Pipe DISABLED Appreciate your replies. Thanks! From http://www.developmentnow.com/g/118_0_0_0_0_0/microsoft-public-sqlserver-server.htm Posted via DevelopmentNow.com Groups http://www.developmentnow.com/g/ On 2010-03-12 2:48, xbluewho wrote: > Can anyone tell me if JTDS supports shared memory access? > No, it doesn't. > I would like to access the DB with TCP and Named Pipe DISABLED > Then you're out of luck. jTDS requires at least one of those. ...

VLOOKUP in VBA
On the worksheet I can insert in a cell =VLOOKUP(C5, Hobokee.xls!AcsLow, 2) and it works perfectly, looks up the value in column 2 of the range named AcsLow in the same workbook. But elswhere I want in a macro to lookup the same table and assign the result to a variable BalAmt. BalAmt = VLOOKUP(AccNum, Hobokee.xls!AcsLow, 2) does not work. It gives a function not defined error on Hobokee. If instead of Hobokee I put Workbooks("Hobokee"), it gives function not defined error for VLOOKUP which it changes to VLookup. I have been overVLOOKUP in the Help file and see nothing wrong. W...

Who want to make friends with me?
Dear everybody I would like to know some foreigners increased their friends circle. And I have been the same person can add interest to me Oh, but I accept all comers. First to introduce myself, I come from China, 18 years old. Get to know the purpose of foreign friends to practice their English Hopes to have increased! Thank you Yours, Matt ...

Excel VBA/Macro programming for beginners
Hi all, I know a bit VB 6.0 programming. Will it help me to write exce vba/macro(same thing?).can anybody help me by providing some fre websites where i can have informations/codes for VBA/macro. Please tell me how could i make a *command Button * in a cell in th excel sheet -- sdebu_200 ----------------------------------------------------------------------- sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=430 View this thread: http://www.officehelp.in/showthread.php?t=118812 Posted from - http://www.officehelp.i Try David McRitchie's "getting started with mac...

Making a Logarithmic Graph
Hi I'm somewhat of a newbie in terms of using MFC and I'm continuing work on a project that already has a linear graph class. What I need to do is implement a logarithmic graph. I know that there is no short-cut for making graphs with MFC and that's why the linear graph class draws everything manually. I would like to know how anybody here would proceed to achieve this. I have a basic idea of how the scale might be made but considering the pre-existing graphing architecture that allows the user to rescale the linear graph. Jumping into this seems overwelming considering all the p...

Turn pc speaker on/off with vba code
Is this possible? Thanks I found something here on how to do it withVBScript. You can probably modify it to work in VBA http://www.pcreview.co.uk/forums/thread-1468591.php -- HTH, Barb Reinhardt "David" wrote: > Is this possible? > Thanks Thanks Barb I'll have a go (I need to improve my web searching skills) "Barb Reinhardt" wrote: > I found something here on how to do it withVBScript. You can probably modify > it to work in VBA > > http://www.pcreview.co.uk/forums/thread-1468591.php > -- > HTH, > ...

Loading a Form from VBA
Hi all, I'd like a module to open and load a form in my Access 2003 database... How can I do this? Use the OpenForm method. Look in the Help file for details. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Mike" <michael.leon.schwartz@gmail.com> wrote in message news:1184770076.109526.207900@o11g2000prd.googlegroups.com... > Hi all, I'd like a module to open and load a form in my Access 2003 > database... How can I do this? > On Jul 18, 10:58 am, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com&g...

Publisher 2007 "working folder"
How do I set a new "working folder" in Pub 07? There are no "File Locations" settings under "Options" as there have been in past versions for opening and saving files somewhere other than My Documents. It's a real pain to constantly have to navigate through 3 folders every time I want to open or save a project. Help!! It isn't an option in 2007. A workaround, File, save as, navigate to the folder you want as default, right-click the "Look in:" task pane, add the folder. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msaue...

Excel and VBA
I am very interested in learning more about using VBA in office, especially Excel. Can you post some resources (online, books, etc) that can be used to help learn about using Visual Basic in office. Thanks! Here's a good place to start: http://www.contextures.com/xlbooks.html Does that help? *********** Regards, Ron XL2002, WinXP "Bob Sinclair" wrote: > I am very interested in learning more about using VBA in office, especially > Excel. Can you post some resources (online, books, etc) that can be used to > help learn about using Visual Basic in office. >...

Cannot Access Email Contacts
Hi: I have been running Office 2007 and Outlook 2007 on an XP Pro system that was fully up to date for about 6 months on an old 3GZ single processor system with 2GB of RAM. I decided to upgrade to a Duo processor about 3 weeks ago and to move upgrade to Windows 7. For the upgrade I choose to use the Windows Easy Transfer program to setup all my accounts. Since moving to the new system I have been unable to connect my Contacts to my email system in Outlook 2007. If I select NEW email and then click on the TO: and type in a name to search for the email address it gives me an...

Form Controls vs VBA controls
I am new to VBA so just finding my feet, can anyone help me with th differences between an excel control (i.e. one from the form toolbox lets say a checkBox and a vba checkBox? From trying the two controls the I have noticed is that you canno capture the change event of the VBA checkbox in the code module, it ha to be done via the sheet (i.e. checkbox on sheet1, code goes in chang event on sheet1) the control is placed on, is this correct? What woul you do if you have three sheets with the same controls just differen data, do you really have to code the control 3 times? The excel control ho...

Making a wizard
I have a table with several lookup fields to other tables. E.g. the Course_Details has a Venue field combo box that looks up the ID from the Venue table. I can not save the Course_Details record until the venue field is populated. However sometimes I may not yet have added the venue. Therefore my idea is to create a series of forms that work like a wizard, the first would ask to select the venue form the dropdown but if it didn�t exist you would click a button to open another form and create it.The problem I have is that when I move onto the next stage of the wizard (because I have not yet sa...

Run VBA without show
I want excel to run the VBA code without showing me what it is doing. Which code should i use for that? Sub RunWithoutShow() Application.ScreenUpdating = False 'Paste the vba code here 'end of code 'Change screenupdating property to true Application.ScreenUpdating = True End Sub I hope this helps... Selva V Pasupathy For more on Excel, VBA, & other Resources Please visit: http://socko.wordpress.com You may also (inserting into quote from code example bellow from Socko) Use Application.Visible property to hide the application entirely Sub RunWithoutShow() Appli...

VBA Customization
Is there a way to get the name of the current company through VBA in Great Plains 8.0? Thanks for all your help. open GreatPlains. Add the current window, it will add the Toolbar then add fields choose the company name on the top left after the user id. >-----Original Message----- >Is there a way to get the name of the current company through VBA in Great >Plains 8.0? > >Thanks for all your help. > > > >. > Thanks. I tried, but I couldn't add company name to the field list. It opens up the login screen instead. Any thoughts? Thanks again. "ger...