Visual Basic 6 & Access 2000


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Thank you!

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default Reading value of Autonum key after insert

    -----------------------------------------------------
    Dim ptrProfile as Long

    Dim dbProfile As Database
    Set dbProfile = OpenDatabase(strPath & "\" & strFilename)
    Dim rsProfile As Recordset
    Set rsProfile = dbProfile.OpenRecordset("tblProfile")

    rsProfile.AddNew
    rsProfile!Description = "bla bla bla"
    rsProfile.Update

    ptrProfile = rsProfile!ptrMenu <-- Primary key, Autonum
    -----------------------------------------------------

    According to one of my Access books this should place the new key into ptrProfile but it doesn't.

    Am I supposed to set special parameters for update? Like UpdateNow or something like that? I see references to Cursor Types and Record Locks but I can't figure how to use them.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Try that.

    Best regards,

    Luciano

    Code:
    rsProfile.AddNew
    rsProfile!Description = "bla bla bla"
    ptrProfile = rsProfile!ptrMenu 
    rsProfile.Update
    Last edited by Luciano; - 31st August 2006 at 20:02.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Thanks.

    I got the SendKeys sample from the Help file working nicely:

    AppActivate Shell("calc.exe", 1)
    For I = 1 To 100
    SendKeys I & "{+}", True
    Next I
    SendKeys "=", True
    SendKeys "%{F4}", True

    How could I modify it so that I don't hardcode the executable? I'd like to be able to chose what running application gets focus.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Have you tried something simple like

    dim TargetAppName as String

    .....


    TargetAppName = "calc.exe"

    .....

    AppActivate Shell(TargetAppName, 1)
    Keith

    www.diyha.co.uk
    www.kat5.tv

  6. #6
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Under most circumstances, SendKeys is not recommended in a production environment.
    This is because the keystrokes are processed by whichever window is currently active
    on the desktop. Obviously this will cause unpredictable behavior in case another app
    receives the focus while your code is processing the Sendkeys statement.
    If you're unlucky, the keystrokes sent to application may cause all documents
    to be deleted or the hard drive to be formatted.
    So try to avoid Sendkeys at all cost.

    Best regards,

    Luciano

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default

    Luciano, The whole reason for this application is to send keystrokes to an application.

    Keith, That's how the Help file does it, I had shrunk it down a bit for testing.


    I was hoping there was a sort of 'list' feature of running applications that I could scroll through; something like ALT-TAB. But now that I think more about it, similar applications make the user select the executable (like the Profiler for the Logitech wheel). By forcing focus on a selected executable, I reduce that danger that Luciano brought up.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Replies: 5
    Last Post: - 24th August 2006, 21:59
  2. Visual Basic 6 question
    By Christopher4187 in forum Off Topic
    Replies: 5
    Last Post: - 3rd July 2006, 13:06
  3. Visual Basic 6 and Pic com
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th September 2005, 05:21
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. '877 and Visual Basic 6
    By Tomas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th March 2004, 02:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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