Results 1 to 8 of 8
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    Dialog Form in place of InputBox


    I have an InputBox that is pre-populated with "ABC:". I want the cursor to start right after the colon. It appears that you can't use SelStart with InputBox. So, I wrote a simple form with only one field in it. When the operator enters the data and hits Enter, I want to close the form. Apparently, I can't close the form in an After Update or On Exit event because the procedure is still running. I also tried adding a dummy text box and closing the form in the GotFocus or On Enter event... same problem. Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What procedure is still running?

    I open and close form for input.

    Are you using acDialog parameter to open the form?

    How are you passing the value back to the calling form?
    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
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    Apparently On Exit or After Update Event is still running when I try to Close the form. If I put a command button to click on, that works fine but it requires the operator to pick up the mouse. Yes, I open it in acDialog mode. I use Public variables to communicate between forms (that part works fine). Anything else?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Can set a shortcut key on the button. An & in front of any character in the button caption or associated label allows that character to be a shortcut key. This allows pressing Alt+char to execute the button click event. If there are no data controls on the form to take focus, don't even need Alt.

    I disable the X close on all forms and use custom button code to close form.

    I've never used form Exit or AfterUpdate events. I have used these events for controls.

    Your popup is bound to data? None of my popups are bound.
    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
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    Thanks for your help... prefer not to use shortcut key. requires extra keystroke. The operator will typically key 5 characters and hit Enter. The On Exit and After Update Events are for the textbox control the operator is entering data in. The popup form is not bound to data.

  6. #6
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    I'm going to mark this as "solved". The only way I was able to do this was to create a small form and open it in dialog mode.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    For InputBox, could put "ABC:" as text in the box message then in code concatenate the "ABC:" string to the user input.

    Is this prefix literally the characters "ABC:" or will that prefix actually vary? If it is literally "ABC:", why bother saving?

    Why not offer users shortcut key defined by & character as option? Users can either mouse or key stroke. I much prefer not having to move hand from keyboard.
    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.

  8. #8
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    The prefix ABC: is an example. To be more precise it will be 14- in 2014 and change to 15- in 2015, etc. 99% of the time, the operator will want to keep the prefix (14-) and type the rest of the identifier after the prefix. The program needs to read the entire string, such as, 14-12345. When I pre-populate the Input Box with 14-, the operator has to hit the right arrow three times or position the cursor after the 14- using the mouse. What I'm trying to do is use something like selStart=4 to default the cursor right after the 14-. In the 1% of the time that the operator will need to enter 14- in 2015, then he/she can back up to the 5 and replace it with a 4. I was unable to find a way to do this with Input Box, so I created my own dialog form where I can use selStart to accomplish what I need. The operators love it now. Thanks anyway.

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

Similar Threads

  1. How to place a form into powerpoint using vba
    By wwjd77414 in forum Access
    Replies: 4
    Last Post: 09-03-2012, 04:41 PM
  2. Replies: 21
    Last Post: 02-14-2011, 02:51 PM
  3. Replies: 3
    Last Post: 11-17-2010, 05:21 PM
  4. Dialog box form example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 10:45 PM
  5. Replies: 0
    Last Post: 02-21-2008, 09:52 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