Results 1 to 3 of 3
  1. #1
    N1755L's Avatar
    N1755L is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Toronto, Ontario
    Posts
    27

    Record selection in subform

    Hello everyone, I have a form that shows multiple rows of linked/child records (I know there's better jargon to describe what I'm trying to explain here, but I'm a bottom-rank amateur at MSAccess and don't know the lingo yet, sorry).



    The form in question is the "frmFilterNumberTypeView" form. When a particular filter is used (installed on an automobile), I would like to be able to click on the corresponding "Installed 1" button left of the filter number, so that by code, I can reduce the Qty on Hand by One, and insert the corresponding filter ID to the History table, along with the date/time the filter was used.

    I'm not asking how to reduce the Qty on Hand, nor how to do the updates to the History table, I'll figure that out myself over the next week or two (hopefully it won't take that long). What I'm trying to figure out here is how I can associate the red "Installed 1" button with the filter to the right of whichever button I press.

    I just have absolutely no idea how to go about figuring this one out, or if it's even possible. Is it? In design view there is only one button with one name (cmdInstalled), but this same button seems to exist many times over in the subform, so I'm at a loss as to how I'm going to code so that the filter number record immediately to the right of whichever red button I push is the same record that is going to be updated/sent to the history table, so that I can keep track of which filters have been used and on which dates.

    Thanks.



    Little side issue... I can't seem to figure out how to sort the filter column on this same form. I'm fairly certain that this would be very easy to do if the subform in question was populated by means of a corresponding query, but I'm afraid that if I go that route that I'll spend another 20+ hours trying to figure out how to get the proper filter records to match the filter manufacturer, not to mention having to next figure out how to link the table so that if I modify any particular filter record, that I'll be able to have the associated table update accordingly.

    Is it possible to sort the filter column without the subform record source being a query?
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Conventional relational database wisdom is to not save calculated data, especially aggregate calcs. In other words, should not adjust a quantity on hand value in table, this value should be calculated from raw data records.

    The buttons exist many times because there are many records, just as the textbox and combobox must replicate for each record, the buttons will replicate. All controls in the detail section will replicate for each record.

    I just tested code in the button click event. It read the value of the ffilternumber field for the record the button is in.
    Debug.Print Me.fFilterNumber

    Can sort subform by setting its Order By property.

    Or by right click on any field to open shortcut menu
    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
    N1755L's Avatar
    N1755L is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Toronto, Ontario
    Posts
    27
    Quote Originally Posted by June7 View Post
    Conventional relational database wisdom is to not save calculated data, especially aggregate calcs. In other words, should not adjust a quantity on hand value in table, this value should be calculated from raw data records.

    ...

    I just tested code in the button click event. It read the value of the ffilternumber field for the record the button is in.
    Debug.Print Me.fFilterNumber
    Thanks June7, I am only saving the filter unique ID and the date it was used in the History table. As you mention, I will later be able to calculate how many of a particular filter have been used and when. The idea is that I would have code for the Installed button that would update the FilterNumbers table, reducing the QtyOnHand field value by 1 every time the button is pushed. I'm not certain how any particular replicated button is going to associate with a particular record, but am going to test that Debug.Print.Me you mention and see if I can figure this out.

    As for the subform Order By property... duh... sorry, had no idea this existed. Thanks, that's EXACTLY what I was hoping for. I knew I could do it by way of context menu, but wanted it "permanent" as your suggestion will achieve.

    Thanks again!
    Last edited by June7; 04-25-2014 at 09:38 AM.

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

Similar Threads

  1. Replies: 8
    Last Post: 08-09-2013, 09:52 AM
  2. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  3. Replies: 6
    Last Post: 08-22-2012, 03:24 AM
  4. Replies: 5
    Last Post: 10-06-2010, 07:28 PM
  5. Subform Selection
    By doug adams in forum Forms
    Replies: 2
    Last Post: 06-28-2009, 10:27 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