Results 1 to 9 of 9
  1. #1
    Markgc is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2011
    Posts
    5

    Setting Up a Field Copy Function Key

    I am not a power user but I am using Access to log my Ham Radio contacts. When I enter data I like to use the copy data from the previous record data field, function which is a ctr ' keypair. I would like to have a single key stroke to perform this function rather than having to use two hands. I would like to set up a single Function key for this purpose. F5 or F8 maybe.



    I would appreciate some advice on how to do this.


    thanks Mark

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i dont' know, but what comes to mind is using a form's "keypress" event and check for the ascii value of the key that was pressed. I believe the function for ascii values is ASC()

  3. #3
    Markgc is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2011
    Posts
    5
    I can probably find out the ASCII value oof the keystroke combination but I don't know what to do then.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    well, when you find it, here's some sample code I wrote once as an e.g. -
    Code:
    Private Sub cmdfill_Click()
    
    On Error Resume Next
    
    Dim c As Control
      Dim rs As Recordset
        Set rs = Me.RecordsetClone
    
        Me.Painting = False
    
    rs.FindFirst "[orderid] = " & Me.orderid
    
      DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
      
          For Each c In Me.Controls
            If Not TypeOf c Is CheckBox Then
              If Not TypeOf c Is Label Then
                If Not TypeOf c Is CommandButton Then
                  If Me.Controls("chk" & c.Name) = -1 Then
                    Debug.Print c.Name
                    c = rs(c.ControlSource)
                  End If
                End If
              End If
            End If
          Next c
       
        Me.Painting = True
    
      rs.Close
    
    Set rs = Nothing
    
    End Sub
    what that does is use a clone of the form's recordset, navigates to the record that's showing on the form using the orderid field, and creates a new records with all the values of that old record. So basically copies it. The big block just loops checkboxes that are named in a patternized fashion to make the example easier. If a field is checked, it's copied. That's not needed for a copy function.

  5. #5
    Markgc is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2011
    Posts
    5
    Thanks but I know so little about this that it is going to be impossible for me to do. I am hardware engineer.

    Excel used to have a nice macro keystoke copy I wonder why this isn't available in Access.

    Is there a tutorial about this anywhere?

    thanks Mark

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you'll have to have someone write the code for you, Mark. It's VBA. If there's someone you know, I'd ask them. I'd do it for ya, but I don't have time.

    I don't believe you can do this through the interface.

    You might though, try a docmd action too:
    Code:
    docmd.runcommand accmdcopyrecord
    not sure if that works, but you can try! Tutorials are all over the place too, so google is the bet.

    I have no idea what the macro keystroke copy is in excel. Never heard of it, or I've heard of it under a different name.

  7. #7
    Markgc is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2011
    Posts
    5
    In Excel you could start a recorder, perform a bunch of keystrokes, stop the recorder and then then have a function key or keystroke combination automatically call and perform the long keystroke chain that you had just recorded.

    I could say make the F8 key perform the ctrl ' function very easily that way.



    Can I call a vba program from a function key...all I want is one key to copy the field value from the last record to the next..pretty simple stuff really. I am tired of having to use two hands to do this simple copy task. When I enter a radio contact often as not a lot of the data field are the same...a two handed copy operation is a real pain to do again and again.

    Mark

  8. #8
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    access is not set up that way. sorry.

    there are no shortcut keys, naturally, in access. there IS a shortcut menu and I believe a property in the form property sheet that something about keys, but I'm not sure. You might want to check that too. But that's complex as well, and probably not for a novice.

    if you don't mind clicking the mouse, that would be your best bet here I'd think. Just like what I did with the tickboxes. Tick the ones to copy and push the button. DONE.

  9. #9
    Markgc is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2011
    Posts
    5
    What I am trying to do is tab over or right arrow over to the next field and hit a key to copy the data to that field from same field in the previous record.

    I tried to post a example but that isn't so easy with html


    Mark



Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy contents of one field to another
    By 10 Gauge in forum Forms
    Replies: 4
    Last Post: 02-11-2011, 09:51 AM
  2. Setting a field in order for Report
    By cotri in forum Reports
    Replies: 2
    Last Post: 01-28-2010, 02:44 PM
  3. Replies: 1
    Last Post: 01-14-2010, 04:10 PM
  4. Setting Field Properties for Numbers
    By Tim Hardison in forum Access
    Replies: 1
    Last Post: 12-09-2009, 06:47 AM
  5. Setting a field to be dependent on another
    By CushingMT in forum Forms
    Replies: 0
    Last Post: 11-19-2008, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums