Page 1 of 3 123 LastLast
Results 1 to 15 of 40
  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: Recreate CTRL +'

    Hi all I am trying to figure out how recreate the CTRL+' function using the AutoKeys macro, or the OnKeyPress of the form.
    I know how to create a macro but I have never created an AutoKey. Can anyone assist?? Pls I did some research and it can be done through a macro

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    So what do you need help with, creating an AutoKeys macro or coding the macro to do the same as CTRL-Quote?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    coding he macro to do the CTRL QUOTE Please

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Have a look at the DLast() function.

    If you are talking about a macro, I can't help as I dodge them like the plague, but you can do the same thing (and more) with VBA.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    Hi StarTrekker ok from what I found I can do it this way

    Dim LTotal As Currency

    LTotal = DLast("UnitPrice", "Order Details", "OrderID = 10248")

    the 10248 is an ID but that can change as the user is entering data, so do I have to give it a specific ID? Or couldnt I just put the Parent ID] in there instead?? Not sure what to do

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes, you can put in the key to the parent record! Well done

    For example:

    LTotal = DLast("UnitPrice", "Order Details", "OrderID = " & Forms!FormName!ObjectName)
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    what if its a subform (Tanf_tbl subform)

    ok so would it look like this
    LTotal = DLast("Earned hours", "Contact Date", "SCAIRCaseWorker", "Catagory for hours", "Services Covered", "State Catagory", "State Services Covered", "Purpose of Contact"=& Forms!TanfParticipants_frm!Parent ID)

    is that ok?? and where in the form properties do I put that in the Onclick are or OnKeyPress??

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Don't mean to be a wet blanket, but DLast() is one of those functions that doesn't do what its name implies!

    From Access Help:
    You can use the DLast functions to return a random record from a particular field in a table or query when you simply need any value from that field."
    In other words, if you use it and it does, indeed, return the value from the last record, this was merely a coincidence!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    Well I need something that will do the equivelant of CTRL + Apostrophe Short Cut Key

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Wow, I must be really really lucky. DLast gets the last record in a recordset for me. Every time.

    ok so would it look like this
    LTotal = DLast("Earned hours", "Contact Date", "SCAIRCaseWorker", "Catagory for hours", "Services Covered", "State Catagory", "State Services Covered", "Purpose of Contact"=& Forms!TanfParticipants_frm!Parent ID)

    is that ok??
    NO. Using VBA you'll have to get the CURRENT FIELD and use that; you cannot specify more arguments than the function supports.

    In the end, nothing will be as easy as CTRL - Quote. Why replicate this anyway? Why not just use CTRL-Quote?
    Last edited by StarTrekker; 08-30-09 at 21:57.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  11. #11
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    the reason why I need to create the macro is because an ADP does not support that

  12. #12
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    I found something on MS website, but now sure how well it will work

    Microsoft Access - RunMacro Macro Action

  13. #13
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Ok, so more building blocks.... in VBA, you can use something called the CurrentControl... or is it ActiveControl... can't remember right now, but it will give you access to the name of the control that has the focus when the AutoKey is pressed. Then your VBA code will use that and fetch the DLast of that field.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  14. #14
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    ok so how exactly is that done? am I going to take this code and add Currentcontrol to it some where???

    Code:
    LTotal = DLast("Earned hours", "Contact Date", "SCAIRCaseWorker", "Catagory for hours", "Services Covered", "State Catagory", "State Services Covered", "Purpose of Contact"=& Forms!TanfParticipants_frm!Parent ID)

  15. #15
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Sorry, but I just don't have the time needed to spell it out for you in detail, especially when you aren't reading! That code I have already said is NOT ok.

    You would need to put the correct code into a VBA which would use the CurrentControl thing to figure out which field you want to copy from the previous record.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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