Results 1 to 9 of 9
  1. #1
    Ant_Snell is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2021
    Location
    UK
    Posts
    118

    Keeping a unbound text box on top.


    I have a switchboard form with a button labelled “Enquiries not actioned” that opens a continuous form listing all the unactioned enquiries. To prevent having to click the button only to find no new enquiries I have put an unbound text box on top of the button that uses a DCount function showing how many enquiries there are. (obviously if the count is zero you wouldn’t bother clicking the button). This works well until you have clicked and open the enquiry form and then closed it to return to the switchboard. It then goes to the back of the button can can't be seen. How can I keep it on top of the button. I have tried refresh, repaint and looked for a “Position, bring to front” property but cant find one. Thanks

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Why not just hide the button? or change it's caption to reflect no records?
    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

  3. #3
    Join Date
    Apr 2017
    Posts
    1,681
    Why don't you simply set the button visible or invisible, depending on conditions. User can't click the invisible button.

  4. #4
    Ant_Snell is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2021
    Location
    UK
    Posts
    118
    Thanks Both, the issue is that there could still be results (a number of none actioned enquiries) e.g. If there was 6 none actioned enquiries and you go and action 1 of them then close the form to return to the switchboard. You still have 5 results however the DCount textbox is now hidden behind the button. I had considered including the DCount calculation within the button text but am not sure if that is possible and if it is not sure of the syntax.

  5. #5
    Join Date
    Apr 2017
    Posts
    1,681
    Whenever you open the form, or change something in form what can change the count of actions, some event of form must check the number of non-actioned enquiries, and setting the buttons visible property to (NumberOfNonActionedEnquiries > 0). When there are some such actions, the button is visible, otherwise it is not visible. About your example - when from 6 non-actioned enquiries one was actioned, the count of non-actioned enquiries will be 5, so the button remains visible!

    Obviously you need several events to control the visibility of button:
    Form's Open event (sets button's visibility at moment you open the form;
    Form's AfterUpdate event (sets button's visibility after added or updated record is saved);
    One of Form's Delete events (for case some non-actioned enquiry was deleted).

    In case actioning is performed in separate form, you probably have to reset the button's visibility in calling AfterUpdate event in this form from form performing the actioning - either by setting it directly, or calling the AfterUpdate even form there after the actioning is saved to table.
    Last edited by ArviLaanemets; 11-21-2023 at 07:06 AM. Reason: Edit:

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Whatever control has the focus will be on top - so perhaps have code to set focus to the unbound textbox

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I would just set the button caption dcount() & to action
    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
    Ant_Snell is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2021
    Location
    UK
    Posts
    118
    Thanks, that almost sorted it, however what I didn't mention in my post was the fact that my Swichbord had 2 simula buttons, 1 for unactioned Enquieries the other for Requiering a follow-up, so I could only set focus to one of them.

    I have however no solved the issue. originaly I left the switchboard open in the background, I now close the switchboard then re open it when closing the enquiery or follow-up forms. that's solved the problem. Thanks for everyone's help.

  9. #9
    pdanes is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Sep 2019
    Posts
    208
    One point - it is almost always better to disable a button, but leave it visible. Hiding controls to keep users from clicking them is bad manners. Users tend to get upset, remembering that there was a control here somewhere 'just a minute ago', and now they can't find it, so they figure something is wrong with the app. Leaving it visible but disabled is generally considered the best method - not hiding anything, but making it clear that the action called by that control is not available at the moment, for whatever reason.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-07-2019, 01:51 AM
  2. Replies: 2
    Last Post: 08-16-2012, 10:02 PM
  3. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  4. Keeping text in a report textbox
    By Hawkx1 in forum Reports
    Replies: 2
    Last Post: 11-13-2008, 04:11 PM
  5. Unbound text box truncating text
    By gddrew in forum Forms
    Replies: 0
    Last Post: 03-02-2006, 11:26 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