SendKeys ...



  • I love the sendkeys command but i never expected to come across it in the wilds.

    Private Sub tbcDetails_Change()
    'Date   : 07-03-2000
    'Input  :
    'Output :
    'Comment:
    On Error GoTo Err_tbcDetails_Change
    
        If Me.tbcDetails.Value = 4 Then
            Me.subActieVolumesArtikelen.Requery
            Me.subActieVolumesArtikelen.SetFocus
            Me.fraWeergaveVolumeArtikelen_Click
            SendKeys "{PgUp}"
            DoEvents
            SendKeys "{PgUp}"
            DoEvents
            
        End If
        
        If Me.tbcDetails.Value = 6 Then
            Me.subActieVolumesDisplays.Requery
            Me.subActieVolumesDisplays.SetFocus
            
            SendKeys "{PgUp}"
            DoEvents
            SendKeys "{PgUp}"
            DoEvents
        End If
        
        If Me.tbcDetails.Value = 5 Then
            Me.subActieVolumesBP.Requery
            Me.subActieVolumesBP.SetFocus
            
            SendKeys "{PgUp}"
            DoEvents
            SendKeys "{PgUp}"
            DoEvents
        End If
        
    Exit_tbcDetails_Change:
        Exit Sub
        
    Err_tbcDetails_Change:
        returnAccessError "tbcDetails_Change frmSelectActies", Err.Number, Err.Description
        Resume Exit_tbcDetails_Change
        
    End Sub
    

    I thought that was the worst ever but then i saw this one ....

    Function handleError()
    'Date   : 12-10-1998
    'Input  :
    'Output :
    'Comment:
    On Error GoTo Err_handleError
            
        Dim str As String
        Dim strModule As String
        
        strModule = Application.CurrentObjectName
        If Left(strModule, 5) = "Form_" Then
            strModule = right(strModule, Len(strModule) - 5)
        End If
        
        str = "^{HOME}^{RIGHT}^{RIGHT}^+{RIGHT}^c"
        str = str & "{HOME}^{END}{LEFT 8}{HOME}{ENTER}{UP}"
        str = str & "Exit_^v:{ENTER}"
        str = str & "Err_^v:{ENTER}"
        str = str & "{TAB}returnAccessError ""^v " & strModule & """, Err.Number, Err.Description {ENTER}"
        str = str & "Resume Exit_^v{ENTER}"
        str = str & "^{HOME}^{RIGHT}^+{RIGHT}^c"
        str = str & "^{END}{LEFT 8}{HOME}{UP 4}"
        str = str & "{TAB}Exit ^v{ENTER 2}{UP 5}"
        str = str & "^{HOME}^{RIGHT}^{RIGHT}^+{RIGHT}^c"
        str = str & "{DOWN}{HOME}"
        str = str & "'Date   : " & Format(Date$, "mm-dd-yyyy")
        str = str & "{ENTER}"
        str = str & "'Input  :"
        str = str & "{ENTER}"
        str = str & "'Output :"
        str = str & "{ENTER}"
        str = str & "'Comment:"
        str = str & "{ENTER}"
        str = str & "On Error goto Err_^v"
        str = str & "{ENTER}" '{TAB}{ENTER}{UP}"
        SendKeys str
    
    Exit_handleError:
        Exit Function
    
    Err_handleError:
        returnAccessError "handleError basError", Err.Number, Err.Description
        Resume Exit_handleError
        
    End Function
    


  • @coentje said:

    'Date : 12-10-1998
     

    Some manager in 1998: "Just whip up a database for this."

    Developer: "I'd rather do this in {insert proper environment here}"

    Manager: "No, we'll only use it for a couple months anyway. Just use Access, I use that all the time."

     

     




  • @coentje said:

        str = str & "{HOME}^{END}{LEFT 8}{HOME}{ENTER}{UP}"

    Of course VB has actually a special syntax just for "use cases" like this. Should we be surprised?



  • @b_redeker said:

    @coentje said:

    'Date : 12-10-1998
     

    Some manager in 1998: "Just whip up a database for this."

    Developer: "I'd rather do this in {insert proper environment here}"

    Manager: "No, we'll only use it for a couple months anyway. Just use Access, I use that all the time."

     

     


    So true, done that exact thing a few times myself. You come back a year later and your shitty little script is now a core business process.



  • Hey, you got Lotus 1-2-3 macros in my Visual Basic!

    You got Visual Basic in my Lotus 1-2-3 macros!



  • @JesusChrist said:

    So true, done that exact thing a few times myself. You come back a year later and your shitty little script is now a core business process.

    You haven't lived until you get called back in (about five years later, at full consulting rates!) to a company who made you redundant; to make some changes to this daft little DB app. you wrote using Paradox for Windows (!).

    I had to do a lot of reading up to refresh my memory beofre going to THAT one.



  • @JesusChrist said:

    So true, done that exact thing a few times myself. You come back a year later and your shitty little script is now a core business process.

    You haven't lived until you get called back in (a few years later, at full consulting rates!) to a company who made you redundant: to make some changes to this daft little DB app. you wrote using Paradox for Windows (!).

    I had to do a lot of reading up to refresh my memory before going out to THAT job!



  • Self-modifying code: you're doing it wrong.



  • @Cad Delworth said:

    @JesusChrist said:

    So true, done that exact thing a few times myself. You come back a year later and your shitty little script is now a core business process.

    You haven't lived until you get called back in (a few years later, at full consulting rates!) to a company who made you redundant: to make some changes to this daft little DB app. you wrote using Paradox for Windows (!).

    I had to do a lot of reading up to refresh my memory before going out to THAT job!

    Been there, done that, laughed and laughed at the guy who replaced me with his fancy degree's and certifications as I, after modifying a crystal report to add a field, proceeded to show him (A) how to set up a network printer, (B) add a user to active directory and set up an exchange mailbox, (C) how to replace a hot-swap drive on a raid-5 array from the stock of extras I had laid in, (D) how to reset a voice mailbox, and generally wandering around and fixing all of the things he couldn't (If he had never worked with a piece of hardware or software, his solution was to replace it with something he had worked with.  Perfectly good firewalls and routers were literally thrown away by this guy.  The one thing he couldn't replace was the production tracking system I had written from scratch, but neither could he make any alterations). . . . . . . And then billed my former employers $200.00 an hour for a 10 hour day, which check was signed and waiting for me when I left.  Of course I had to fix the comptroller's printer first. . . .



  •  @coentje said:

    str = str & "^{HOME}^{RIGHT}^{RIGHT}^+{RIGHT}^c"

     This feels like some sort of VBA version of the konami code


Log in to reply