Results 1 to 5 of 5
  1. #1
    vthomeschoolmom is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    5

    sub form insertion / right click


    I have a form with a sub form that has a master record of data and a sub-form that is a grid of detail data. One of the columns on the sub-form is a number. I want to right click on the row in the sub-form and insert. I can click New Record for instance. Before inserting the new record, I want to be able to capture the current row's numeric column. I then want to increment the number for every row after that. The code to do that is easy. But I cannot think what event I need to do it on. Before insert fires after I have navigated away.

    Tip anyone? Thanks

    S

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Maybe form Click event to set variable, but only if the value is greater than current value of variable. I am assuming this is a global variable. I don't know how to make this a right click action.

    I don't understand why incrementing value based on column number.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    vthomeschoolmom is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    5
    Basically, the detail grid contains a list of steps. When I insert a new row, I want the step #s to increment from that record on. The code to do the increment is trivial. What I cannot see is how to get the id of the current row before moving off it for insertion.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    What is the nature of this ID - a custom unique ID? You want the value of the ID that is in field of current record? Try the form click event and code to set a global variable or an unbound textbox on form to hold value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    vthomeschoolmom is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    5
    I figured it out. Form_Current has

    If Not IsNull(Me.Step_Number) Then lngLastTestID = Me.Step_Number

    The value is not null if it is not a new record.

    Then

    I reorder the steps in Form_BeforeInsert. I would like to do it in whatever event immediately preceeds this. But this works well enough.

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

Similar Threads

  1. Replies: 3
    Last Post: 01-05-2012, 09:57 AM
  2. Replies: 1
    Last Post: 07-18-2011, 03:08 AM
  3. Replies: 1
    Last Post: 03-03-2010, 07:29 PM
  4. Form on click
    By rexb in forum Forms
    Replies: 0
    Last Post: 11-16-2009, 08:49 AM
  5. Automatic Date insertion
    By wbeau in forum Access
    Replies: 0
    Last Post: 03-10-2009, 12:51 PM

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