Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2007
    Location
    Harrisburg, PA
    Posts
    44

    Unanswered: Highlighting combobox on gotfocus

    Hi there,

    I am new to this forum and somewhat new to Access. Everthing I have learned I have figured out on my own, so I can get confused sometimes. Sorry in advance.

    I am working on a Data Access Page for the company I work for that will let you enter a Sales Order for gift cards. It is run from a networked drive so that everyone can use it regardless of having Access on their system or not.

    My question is:

    When I tab over to a combo box (dropdown box) on a new record, the cursor dissapears and the box does not highlight to show that it has focus. I need to find out how to show focus so that the user does not get confused or lost when they tab to the next control.

    I have tried to set a default value, but that never seems to show up on the data access page, only on the table it links to. I have tried all the ways I know to figure this out and need help. Any ideas?

    Thank you.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I've seen the cursor seem to "disappear" when a combobox got the focus if I set up the combobox with certain foreground/background colors. Have you tried experimenting with possibly some different foreground/background colors for the combobox?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Oct 2007
    Location
    Harrisburg, PA
    Posts
    44
    I tried different color combos to "find" the cursor but to no avail.

    I messed with it over the weekend and actually had a co-worker who does some of our website code help out. This is what he came up with:

    In the head of the page, you need to create a javascript function that will change the background color by retreiving the id of the input. This is the function:

    <head>
    <script type="text/javascript">
    function setStyle(x)
    {
    document.getElementById(x).style.background="#CC00 00"
    }
    </script>
    <title>Untitled Document</title>
    </head>


    Once you have made the function, you must call it on the gotfocus event on the particular combobox you wish to highlight.

    <body>
    <form id="form1" name="form1" method="post" action="">
    <p><b>TextField1: </b>
    <input type="text" name="textfield" />
    </p>
    <p><b>Salesperson:</b>
    <select name="select" onfocus="setStyle(this.id)" id="whatever">
    <option selected="selected">(Select Salesperson)</option>
    <option>Bob</option>
    <option>Joe</option>
    <option>Tom</option>
    <option>George</option>
    </select>
    </p>


    If you wish for the highlight to go away once you have made a selection, you can make a similar function that sets the background color to white and have it run on the Afterupdate or onChange event.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    ok....seems like a long route to go about it since it's basically just changing the background color - correct? This can easily be done in the GotFocus event for the field (i.e. me.MyFieldName.BackColor = 22343) and changing it to another color in the LostFocus event. I'm not sure why you would need to find the ID and use a select statement in the code (or hard-code in names.)
    Last edited by pkstormy; 10-29-07 at 14:39.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by pkstormy
    ok....seems like a long route to go about it since it's basically just changing the background color - correct? This can easily be done in the GotFocus event for the field (i.e. me.MyFieldName.BackColor = 22343) and changing it to another color in the LostFocus event. I'm not sure why you would need to find the ID and use a select statement in the code (or hard-code in names.)
    Id agree the gotfocus / lostfocus events 'd be the first place Id look, but then again not having used DAP's Im not certain they support them.

    BTW Andy did say he got the suggestion from a web developer.... and that's a fairly standard web developer answer.. use Javascript

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •