Results 1 to 6 of 6

Thread: Calling another executable

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    325

    Calling another executable

    When I click a button which is supposed to call an executable which is a time clock program, I get an error each time that says " no current record". This happens when "timer" is called. Any ideas?
    Code:
    Private Sub cmdInOut_Click()
        Dim wSS As Workspace
        Dim ssDB As DAO.Database
        Dim retVal, xs As String
        
        lt = TimeValue(Now)
    
        Set wSS = CreateWorkspace("", "admin", "", dbUseJet)
        Set ssDB = wSS.OpenDatabase(sysDBPath & "")
        ssDB.Execute "DELETE * FROM timeKeeping WHERE rID=" & registerID, dbFailOnError
        tk = Now
             
        On Error Resume Next
        xs = ssDB.TableDefs("timeKeeping").Fields("prog").Name
        On Error GoTo 0
        If xs <> "prog" Then
            ssDB.TableDefs("timeKeeping").Fields.Append _
            ssDB.TableDefs("timeKeeping").CreateField("prog", dbText)
            ssDB.TableDefs("timeKeeping").Fields("prog").DefaultValue = ""
            ssDB.Execute "UPDATE timeKeeping SET prog=''", dbFailOnError
        End If
        
        xs = ""
        On Error Resume Next
        xs = ssDB.TableDefs("timeKeeping").Fields("printer").Name
        On Error GoTo 0
        If xs <> "printer" Then
            ssDB.TableDefs("timeKeeping").Fields.Append _
            ssDB.TableDefs("timeKeeping").CreateField("printer", dbText)
            ssDB.TableDefs("timeKeeping").Fields("printer").DefaultValue = ""
            ssDB.Execute "UPDATE timeKeeping SET printer=''", dbFailOnError
        End If
        
        xs = ""
       
        setDefaultPrinter
        
        If registerID < 0 Then setRegisterParameters
        
        ssDB.Execute "INSERT INTO timeKeeping (currDate,rID,coNum,prog,printer) " & _
                     "VALUES(#" & tk & "#," & registerID & "," & comp & _
                     ",'FB',""" & Printer.DeviceName & """)", dbFailOnError
        Set ssDB = Nothing
        Set wSS = Nothing
        
        pcKB.Enabled = False
        xs = "C:\Aces Projects\TM\Timer.Exe "
        retVal = Shell(xs, 1)   ' Run Timer.Exe
        AppActivate retVal      ' Activate the Timer.Exe
        SendKeys tk
        timerTK.Enabled = True
    End Sub
    
    Private Sub cmdM_Click(Index As Integer)
        Dim i As Integer
        
        If txt.Visible = False Then Exit Sub
        
        i = ss 'txt.SelStart
        
        Select Case Index
        Case 0
            If i > 0 Then i = i - 1                     'vbKeyLeft
        Case 1
            If i < Len(txt) Then i = i + 1              'vbKeyRight
        Case 2
            txt = Left(txt, i) & " " & Mid(txt, i + 1)  'vbKeySpace
            i = i + 1
        End Select
        txt.SetFocus
        txt.SelStart = i
        ss = i
    End Sub
    Last edited by Hack; Feb 28th, 2008 at 11:53 AM. Reason: Added Code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width