Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 26th, 2007, 03:25 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default Msg Box with Combo List

Is there a way to pop a message box that utilizes a combo box for the response?

I have created a form with a combo box which I was going to use for the same effect as a message box, however I could not figure out how to get my code to "pause" or "wait" for the user response before proceeding.

I am off the beaten path?

Coby.



Reply With Quote
  #2 (permalink)  
Old July 27th, 2007, 06:56 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I got an answer to my own question from outside of the forum, but will share it with everyone.

1st Open the form acDialog (NOT Modal which is halts other things than code running)
2nd Get the user's input
3rd SetVisible property of the pop up form = False on the pop up form close event or okbutton push,etc
4th Get the data from the form as it is still open, yet just hidden
5th close the form and the code, loops, etc continue.


Reply With Quote
  #3 (permalink)  
Old July 28th, 2007, 09:11 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Coby,

I have several generic forms in projects that I use to "do stuff", such as progress bars, custom message boxes and prompts etc.

I implemented them this way.

1. Create the form, in the form create a member variable, I tend to call mine m_KeepAlive.
2. Create a method to act as the form initialiser. I call mine Init. You can
use this to pass important information such as prompt messages etc.
3. In the Init method, set m_KeepAlive to True and Me.Visible = True.
4. Then call a method that will perform a Do..Loop Until m_KeepAlive = False.
5. You can then set m_KeepAlive to FALSE whenever you want the form to close.

Outside of that form, you have your "calling" code. Here you want something like:
Code:
Dim frm as New PromptForm 'Create instance of the form. - This will be hidden.
frm.Init ( Args ) 'Call the Init method with args. This will make the form visible and set any specific details.
'This will also put the form into an endless look (until m_KeepAlive = False) and no further code here will be executed. Once m_KeepAlive = False, the code will continue here and the form can be destroyed.
Oh, and of course if you need access to form information, create properties.

Hope this helps, I find it great as allows you to drag-n-drop into new projects, as all the form code is encapsualted.

Regards,
Rob

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
Reply With Quote
  #4 (permalink)  
Old July 28th, 2007, 09:35 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

AhHa. Your angle on that gives me some more perspective now that I am getting into the realm of opening and closing forms more frequently and during loops and such.

I now also now that I need to start "compartmentalizing" my programming a little more so that I can have more generics and standards while isolating the special things which will allow me to carry the least amount of unique code as possible.

I have been programming in acces for less than a year and prior to that I just played around with Excel macros.
Right now, I have a managable amount of purposes involved in my program and generally can take care of each purpose with one module, but as things progress I will need to split out the generics to call to rather than have redundant things everywhere.


Thanks for your insight.

Reply With Quote
  #5 (permalink)  
Old July 28th, 2007, 10:29 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Coby,

Your more than welcome. Everyone has to start somewhere. At work I am currently developing in VBA,
but doing MCAD to get up to speed (or on the ladder) on C#.NET.

If you are serious about getting into programming, I would recommed getting into software engineering
principles, design patterns, refactoring and so forth. Programming languages are pretty simple (IMO)
once you have the syntax down, producing high quality code that meets a spec is what makes you a GOOD
programmer, and being able to do that means effective, efficient design, which often has only a small
amount to do with the actual code (altough the jumpe from VBA/6 to Object-Orientated can cause "issues").

Glad to give you some food for thought.


<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IsValidData combo list box function JMichael Visual Basic 2005 Basics 4 June 20th, 2007 11:13 AM
Limiting a combo box to default list hamffjs Excel VBA 1 July 17th, 2006 03:19 PM
Combo List Box dragondayz Pro VB.NET 2002/2003 1 May 30th, 2006 06:05 AM
Drop Down/Combo box/List in a Form from DB mazimi Classic ASP Basics 2 October 1st, 2004 10:43 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM



All times are GMT -4. The time now is 11:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.