Results 1 to 12 of 12
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714

    Pseudo record selector in continuous sub form?

    I've got a template form that has all the command buttons that are needed for navigation and save/exit/copy/delete on a form.
    I just got started with a complicated continuous-sub form (my first) and for the moment I'm using Record Selector Yes,
    because without it I'm lost as to which row/record is active (the "row" is actually four lines of textboxes deep).
    The record selector is great in knowing which record is active but it's save/delete/move features conflict with my navigation command buttons and the code behind them.

    I'm thinking a similar thin label with the verticle word "Active" might do the trick, and the other rows shown with a grayed-out label.
    But so far, if I set a label color or text, it gets applied to all the rows, as they all share the same properties.

    Got a trick to find out which row is active and set the label property for just that row/record?

    (And for those that have been giving some attention to my "silly" questions, you can see here some of your great suggestions being used.)



    Click image for larger version. 

Name:	221022RecSel1.jpg 
Views:	29 
Size:	107.8 KB 
ID:	48965
    Last edited by twgonder; 10-22-2022 at 09:06 AM. Reason: spelling

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    The black arrow on the record selector tells you the active record.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    I think better to use conditional formatting
    Have a hidden text box in the header called say txtCurrent

    In the form current event put something like
    txtCurrent=me.pk

    then use conditional formatting to color one or more controls with

    expression is ……[txtcurrent]=me.pk

  4. #4
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714
    That sounds like a good idea (it's got my brain working in circles), I think. I'm not sure what you mean by me.pk (primary key?) and why the header.
    I was thinking of a label, because I have translation in a form for labels, but again, it would apply to all the labels for each row.
    I also don't have a primary key for the field until the save button is pressed, then it gets an ID (which is a hidden field already in the form).
    The user starts with an empty sub-form, and presses the new button to start a record, enters the data, then presses save.
    I'll go play with the idea and see if I can make some sense of it.

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    labels do not have conditional formatting

    pk=primary key

    you can create a textbox in the detail section, sized to the size of your detail section and sent to back with enabled =false and locked =true and apply conditional formatting to that

    Because of your non standard way of doing things, perhaps use the whatever it is that you eventually store as a PK, use that and set its default value to "" if its a string or perhaps -1 if it is a number - you can use the format property of the control to hide negative numbers - pretty sure that has been covered with you in the past but the format would be something like 0;""

    Note that null=null won't work, which is why you have to have a value

  6. #6
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714

    Strange subform behaviors

    I'm a bit baffeled by this subform. I was testing, watching things in the debugger, and when the main form is started, the subform, which has five records tied to the parent record, goes to the Sub Form_Current() three times and the Sub Form_BeforeUpdate two times before the form appears, inbetween the first to Sub Form_Current().

    In addition, just moving the scroll bar causes the Form_BeforeUpdate to trigger.

    I will test on a more simple and "standard" design to see if it happens there too.

    On top of that, the conditions to allow for the conditional format (if I did it right) seem to exist (the two highlighted textboxesfields are equal), but the formatting isn't being done. Very strange.

    Click image for larger version. 

Name:	221022RecSel2.jpg 
Views:	21 
Size:	133.3 KB 
ID:	48971

    Click image for larger version. 

Name:	221022RecSel3.jpg 
Views:	21 
Size:	102.5 KB 
ID:	48972

    tbxn_CurrRecDt is in the form header and has a time/date
    tbxn_CurrRec is bound to a date field in the record
    Formatting should change the background color to turquoise when they are equal if I understand the rule correctly.
    Last edited by twgonder; 10-22-2022 at 01:16 PM. Reason: add stuff after unwanted save

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,563
    Subforms load before mainform?

    Strange to you, and yes I dare say you are you are going to say illogical, but that is what they do.
    You need to work with it. Same with events. A current event executes when a form loads, perhaps more than once. I have seen that in my F8 walkthrough as well.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    See this example. It’s for a multi select form, but easy enough to modify to next be current selection

    https://www.access-programmers.co.uk...t-form.289116/

  9. #9
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714

    Strange things that go bump

    Quote Originally Posted by Welshgasman View Post
    Subforms load before mainform? <img src="images/smilies/frown.png" border="0" alt="" title="Frown" smilieid="11" class="inlineimg"><br>
    <br>
    Strange to you, ...
    <br>

    Dang, this forum software did it to me again. It logged me out after just a bit of time, then let me type in my post, and turned it to crap after I had to log back in.
    And while they're at it, maybe they can fix that you can't select and replace text?

    Here's a strange one to play with. I went back to basics to see what Access is doing.<br>A flag (date) is getting set to trigger conditional formatting on the last column of the sub data area. That's not working, or I'm doing it wrong.<br>If you move between parent records, then the flag gets reset with a BEFOREUPDATE even when you're just needing to get current on the record<br>AND that RESETS THE DATE FLAG!<br><br>How can we stop that?!!!<br>How do we get the conditional formatting to work (I'm just looking to get the background color set for the text box).

    SimpleParChild.accdb

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    How do we get the conditional formatting to work


    You have examples so confident you can work it out.

  11. #11
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714

    This did the trick, or got me in the right direction anyways!

    Quote Originally Posted by CJ_London View Post
    See this example. It’s for a multi select form, but easy enough to modify to next be current selection

    https://www.access-programmers.co.uk...t-form.289116/

    A BIG thanks for posting this multi select form!
    I've been waylaid with some other projects and just got back to this one.
    It took me a bit, but I got what I wanted to work.
    A little stumbling block was trying to set the background color for the "altback" textbox to transparent.
    Also, the altback text box tends to blank out the record area, so a simple set focus to first input field bypasses this when the altback gets focus.

  12. #12
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    A little stumbling block was trying to set the background color for the "altback" textbox to transparent.
    transparent isn't a colour choice, it's a different property - for colour, set it to the same colour as the detail section

    Also, the altback text box tends to blank out the record area
    Not sure what this means - the altback text box needs to be 'sent to back' on the Arrange ribbon

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

Similar Threads

  1. Subform Record Selector Help
    By Aph002 in forum Access
    Replies: 20
    Last Post: 06-08-2021, 03:05 AM
  2. Subform record selector not working
    By PrimaryKey in forum Forms
    Replies: 8
    Last Post: 02-23-2018, 11:52 AM
  3. Replies: 5
    Last Post: 10-26-2017, 01:13 PM
  4. Record Selector in Tabbed Forms
    By Michelle_Perron in forum Forms
    Replies: 6
    Last Post: 02-04-2014, 01:58 PM
  5. form record selector not working
    By jmk909er in forum Forms
    Replies: 3
    Last Post: 10-21-2010, 08:31 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