UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Inputbox Is Not Quite Sufficient, Access 2010    
 
   
JohnvanSomeren
post Dec 7 2017, 12:01 PM
Post#1



Posts: 641
Joined: 31-August 12
From: London, England


How do I write my own InputBox form which waits on the user?

In my system all ussers are logged on during the Open event of the Main Menu form. No user input was required until now. Now I want the users to select which branch they are working on during that session.

There is no form open at this time (the main menu hasn't displayed yet) and I could, if pushed, code this:
CODE
    If HomeBranch = "??" then
        strCurrentBranch = InputBox "What Branch ID?"
        '[add validation code here]
    else
        strCurrentBranch = HomeBranch
    end if

However I want users to select from a combo box. I built a form with only the combo box and an OK button. The OK button updated tblUsers with the selected current branch.

My code now says
CODE
    If HomeBranch = "??" then
        docmd.OpenForm "frmChangeBranch"
    else
        strCurrentBranch = HomeBranch
    end if


I honestly did not know that Access would not wait on the open form. It doesn't: it just opens the window and passes on to all the commands right down to the end sub.
Go to the top of the page
 
theDBguy
post Dec 7 2017, 12:02 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,208
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Try adding the acDialog argument to your OpenForm method.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JohnvanSomeren
post Dec 7 2017, 12:19 PM
Post#3



Posts: 641
Joined: 31-August 12
From: London, England


Got it. 100% solved. It's been a long time since I've seen your signature on a reply to one of my problems, but you are still hitting gold. Many thanks.

Attached File(s)
Attached File  Capture.JPG ( 11.88K )Number of downloads: 0
 
Go to the top of the page
 
theDBguy
post Dec 7 2017, 12:29 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,208
Joined: 19-June 07
From: SunnySandyEggo


Hi John,

You're welcome and thanks. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    12th December 2017 - 02:58 PM