Populate List Box - Simply w/VBA Code

Need some ideas.  

I have a list box from which our clients will be able to select which form
they want to preview or print.  However, each client should only have
selections available that apply specifically to their company.  For example:

Company A will require forms 1, 2, 3, 6 and 7
Company B will require forms 1, 6 and 7 
Company C will require forms 4, 5 and 6

I have some code right now to handle a simple two form variation:

If Forms("Main").Controls("Form1Req") = "Yes" and Forms("Main").Controls
("Form2Req") = "No" Then
Me.ListBox.RowSource = "Form 1" 
Else
If Forms("Main").Controls("Form1Req") = "No" and Forms("Main").Controls
("Form2Req") = "No" Then
Me.ListBox.RowSource = "Form 2" 
Else
If Forms("Main").Controls("Form1Req") = "Yes" and Forms("Main").Controls
("Form2Req") = "Yes" Then
Me.ListBox.RowSource = "Form 1; Form 2" 
Else 

If I want to continually make available more forms, the coding will become
overwhelming as I would have to take into account every possible combination
(the math of 1x2x3x4x5 for 5 options).  Anyway this could be simplified?

B

-- 
Message posted via http://www.accessmonster.com

0
bhipwell
7/18/2007 5:52:03 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
2586 Views

Similar Articles

[PageSpeed] 3

Create a table with two fields: one being the report to run and the other 
being the company. Put the company id somewhere on the form (it doesn't have 
to visible) and have the list box's RowSource use it as a criteria to limit 
what's displayed.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"bhipwell via AccessMonster.com" <u30281@uwe> wrote in message 
news:755de8f01166f@uwe...
> Need some ideas.
>
> I have a list box from which our clients will be able to select which form
> they want to preview or print.  However, each client should only have
> selections available that apply specifically to their company.  For 
> example:
>
> Company A will require forms 1, 2, 3, 6 and 7
> Company B will require forms 1, 6 and 7
> Company C will require forms 4, 5 and 6
>
> I have some code right now to handle a simple two form variation:
>
> If Forms("Main").Controls("Form1Req") = "Yes" and Forms("Main").Controls
> ("Form2Req") = "No" Then
> Me.ListBox.RowSource = "Form 1"
> Else
> If Forms("Main").Controls("Form1Req") = "No" and Forms("Main").Controls
> ("Form2Req") = "No" Then
> Me.ListBox.RowSource = "Form 2"
> Else
> If Forms("Main").Controls("Form1Req") = "Yes" and Forms("Main").Controls
> ("Form2Req") = "Yes" Then
> Me.ListBox.RowSource = "Form 1; Form 2"
> Else
>
> If I want to continually make available more forms, the coding will become
> overwhelming as I would have to take into account every possible 
> combination
> (the math of 1x2x3x4x5 for 5 options).  Anyway this could be simplified?
>
> B
>
> -- 
> Message posted via http://www.accessmonster.com
> 


0
Douglas
7/18/2007 8:50:16 PM
Thanks, I'll try some version of your suggestion.  Just trying to avoid
coding the potential 300k different combinations.

-- 
Message posted via http://www.accessmonster.com

0
bhipwell
7/19/2007 5:52:22 PM
Reply:

Similar Artilces:

Event ID 3009 A non-delivery report with a status code of 5.1.0 appears randomly.
Exchange 2003 mail enabled Public Folder randomly don't receive e-mail from external sender, when it happens sender receives error : --------------------------------------------- Final-Recipient: rfc822;xxx@xxx.com Action: failed Status: 5.1.0 --------------------------------------------- Sometimes all work ok. Error in Application log : --------------------------------------------- Event Type: Error Event Source: MSExchangeTransport Event Category: (8) Event ID: 3009 Date: 2005.12.21 Time: 11:43:32 User: N/A Computer: MailServerName Description: The description for Event ID ( 3009 ...

Text box scroll from record to record
Hi, I have a screen that shows records from a table. Next to each record is a command button to edit each record. If I click on the edit button a new window opens showing the fields for the record selected. In that window I have a text box. Sometimes, if I'm in that text box and scroll using the wheel on the mouse the data displayed will change from record to record from my table. Can someone tell my why this is happening? I'm running Access 2000 Thanks, -- Phil Its an annoying feature of Access, which while occasionally useful, is more often a PITA. You'll...

How do I stop text from automatically filling another text box?
When I type in one box, the same text appears in another box. How do I unlink them? Someone answered my questions but the link isn't working so I can't see the response. Please answer again. Edit, Undo Synchronize. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Chicago" <Chicago@discussions.microsoft.com> wrote in message news:650076B3-99E6-4043-993C-7171FA4D0396@microsoft.com... > When I type in one box, the same text appears in another box. How do I > unlink them? > > Someone answered my...

Cells with Validation lists attached
How can I indictate that a cell has a valaidation list attached to it without having to select the cell...so that if someone views the xls they can tell which cells have a validation list associated without having to actually select the individual cells? edit/goto special, validation, then give it a color...? Bob Umlas excel MVP "Mike" <Mike@discussions.microsoft.com> wrote in message news:49AFC808-DE74-4E39-9978-893352BE288E@microsoft.com... > How can I indictate that a cell has a valaidation list attached to it without > having to select the cell...so that if som...

Drop Down boxes #10
I would like to put some drop down boxes in an excel spreadsheet to show the way it would look in another program, but am having trouble getting them to either add the extra items, or show once I think I have it entered right! the box I want to add either has names or categories... I took one out of the program I am emulating, but when I do it in excel I don't get the same options (ie Display values) does anyone know what needs to be entered/changed and where??? Kelly Hi what drop down boxes are you using? -- Regards Frank Kabel Frankfurt, Germany "Kelly" <anonymo...

Display apostrophe in Combo Box
I have a combo box which displays the employee names from a table. Users select an entry to "reassign" a unit of work to another individual. There are several employees with apostrophies in their name. The name appears without the apostrophe in the combo box, so when work is reassigned, it displays the name differently than when updated from any other process. Example: Audit trail updates show the individual as "O'Connor" but updates using the combo box show "OConnor". Is there any way, without using code to load the combox, to display the correct name...

Populating Excel from CSV
Hello all, I need to know how to populate an Excel template with data from a external CSV file. Let's say I have this nice pretty colourful templat that is far more pleasing to the eye than the usual chunk of importe CSV data, what are some methods to populate it with data from a CS file?? Any ideas or suggestions or redirections would be much appreciated. Thanks in advance : -- AJMorgan59 ----------------------------------------------------------------------- AJMorgan591's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2777 View this thread: http://www.ex...

Sequence Not populated for the MO Numbers during Data Collection
When data collection is done for the MO Numbers by using the Data Collection Window under Manufaturing, the Sequnce look up does not show the whole list, it only shows NOTES, for the user to select and enter the necessary data. why does this happen in the case of some MO Numbers and in the others it shows all the sequnces as NOTES,MAKE READY, PRESS RUN, WASH UP, MAINTENANCE, REPAIRS, REWIND/INSPECTION, etc. Any information would be much appreciated -- Thanks AshaM It should show all of the router steps. Are some of your steps possibly marked to backflush labor? These steps would not...

record search with combo box.
I have three combo boxes on a form. In order, each allow my to pick data that narrows the search and options in the next. Based on the options picked in each, data is returned in a subform. Is it possible on the third combo box to search on the results. Example; combo box results may list "HP Deskjet 820/830C/832C/850C/855/870/880/882/890/895 Series" in the drop down, but I would like to type in 820 and have the results display in the subform. Thanks Martin Green has some excellent stuff on combo box search functions at www.fontstuff.com or I'm sure allen browne ...

how do populate empty cells with the contents of populated cells .
I have this worksheet problem. The work sheet is thousands of rows long. One of my columns has cells not populated. I would like to get any empty cell in this column to populate itself with the contents of the next populated cell below it? Kind of a "find and replace" action where by an empty cell says to it self;"I'm going fill myself in with the next thing I find below me" I would greatly appreciate if someone can relate how to do this. Thanks Jim, Select the column, use Edit | Go To... Special , Blanks, OK. Then type an equal sign, press the down arrow...

Distribution List Not Visible in Contacts #2
I have Exchange 2003 and outlook 2003 installed in clients , i created a new universal distribution lists, but its not visible in contacts in any of the clients machine, mail can still be sent to the list but it dosenot appear on the contacts.I tried rebuilding the RUS , i created it 2 days ago.... ...

Autoplay for Pictures Not Populated
I inserted my XD card in to my card reader today and the autoplay pop up window asking what I wanted Windows to do was blank. For Video, Music and Mixed content the options are there but not for Pictures - it is just blank. I have tried running autofix.exe but this has not fixed it. Any ideas? Is this a Microsoft problem or has something else caused this? It worked fine until today. Thanks. Peachypumpkin wrote: > I inserted my XD card in to my card reader today and the autoplay > pop up window asking what I wanted Windows to do was blank. For > Video, Music and Mi...

Simplify code to pass parameters
I used a sub in which need to pass about 15 parameters. How to simplify it? Protected Sub test(ByVal _a As String, ByVal _b As String) //about 15 parameters will pass Dim s As String = "insert into AAA a, b value(" & _a & ", " & _b & ")" End Sub -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1 aspfun via DotNetMonster.com wrote: > I used a sub in which need to pass about 15 parameters. How to simplify it? > > Protected Sub test(ByVal _a As String, ByVal _b As Str...

Check Box #2
Hello, I have a checkbox control IDC_CHECK1 and am trying to get the value when the checkbox is checked. Does anybody know what value IDC_CHECK1 returns? Is there an accessor method that returns this value? Thank you. Victor. Hi, Thanks for replying. While searching for a solution, I found this: int num = IsDlgButtonChecked(IDC_CHECK1); num is non-zero when it is checked Thanks, Victor. "Scott McPhillips [MVP]" wrote: > victorsk wrote: > > > Hello, > > > > I have a checkbox control IDC_CHECK1 and am trying to get the value when the > &g...

Multiple selection list box...
I have a multiple selection listbox on a dialog box. When the user picks the listbox items and clicks "OK" my program draws to the main screen. If the user reopens the previous dialog box, I want the previously chosen listbox choices to be highlighted. How would I do this? Thanks, RABMissouri Store the selection in a common place like the Document or MainFrame or the App and do the selection in the OnInitDialog() member function of your dialog. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "RBert" <drbert@microcore.net> wrote in m...

delete user from global address list
How do I remove a user from the global address list? Thanks in advance Greg On Sun, 21 Aug 2005 05:50:02 -0700, "Greg" <gregkh@hotmail.com> wrote: >How do I remove a user from the global address list? > >Thanks in advance > >Greg Delete the account? Hide it? either or both if possible. But I do not want to delete the Domain account. Greg "Andy David - Exchange MVP" wrote: > On Sun, 21 Aug 2005 05:50:02 -0700, "Greg" <gregkh@hotmail.com> wrote: > > >How do I remove a user from the global address list? > > >...

Product lists in categories
Is it possible in CRM to organise the lists of products so that they are a bit more 'user friendly' At present if a user adds an order to an account or contact it appears the only option is an alphabetical list of all products which is fine if you have 6 products but not so fine if you have 6000! Ideally we would like to be able to create a product hierarchy so that instead of a customer needing to look for "Salmon canapes" and not finding it because it was entered as "Canapes (salmon)" the user should be able to navigate through a hierarchy of "Food | Snacks ...

can you make a drop down list in a drop down list?
I have a problem, i created a drop down list of jobs that could have been preformed i need to create another list for each of those jobs to be more specific with what exactly was preformed i had this great idea that maybe if i picked for example warranty work that another list would drop down and let me pick manufacturing or vendor then another list would drop down and i could pick what kinda manufact. or vendor warranty it was. this may not be possible though it would be a great thing to implement in the future i need a way that is user friendly to detail what work was done. any ideas?...

Adding country to list
Hi, I want to add country & currency to the list.. I can only add currency.. Does anyone have an idea how to add countries?? Regards, Ashish ...

City and State Populated by Zip Code
Does anyone know of a way to load a program that when you type in the Zip Code the City and State are automatically populated? I have seen a MSCRM add-in from a company called QAS (http://www.qas.com/). This is more than just Zip Code/City&State. It's a full address validator along with streamlined data entry. They have integrated with CRM via an ISV pop-up and it seems to work fairly smoothly. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On 15 Apr 2005 11:13:56 -0700, "Morgan" <tzeoli@att.net> wr...

Populating a field
I want to populate a description field based on a par number that is entered in the field before it. In other owrds, you enter a part number and presto, in the next field, the description is entered for you. Can you help?? Thanx Tom On Thu, 6 Dec 2007 08:48:01 -0800, Tom <Tom@discussions.microsoft.com> wrote: >I want to populate a description field based on a par number that is entered >in the field before it. In other owrds, you enter a part number and presto, >in the next field, the description is entered for you. > >Can you help?? > >Thanx >Tom If yo...

How to open another user's folder list?
Hello, I have Outlook 2002 SP3 and Windows XP SP2. In my Folder List I have my mailbox expanded showing all my folders (inbox, calendar, contacts, etc.). I also have the mailbox for our general company email account (info@) that receives the emails submitted from our website. But when I click on the + sign next to it to expand it, I get a message saying "Unable to expand the folder. The set of folders could not be opened. The operation failed." This company email is set up as it's own user on our network, and I am set as it's delegate with full control over all it's ...

multiple monitors & dialogue boxes
Using Dynamics GP 8.0 - If multiple monitors are in use, dialogue boxes (e.g. "do you want to save changes" - yes, no, cancel) only pop-up in the primary monitor, not the monitor displaying Dynamics GP. Dialogue/message boxes should pop-up inside the Dynamics GP window so you don't have to mouse over to the other screen to click them. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, fol...

VBA to add sheet; with name; after checking first
XL 2003 & 97 Almost have it. (I think) My "If Not" syntax below is incorrect. The middle line works fine. If Not Sheets.Name("New") Then Sheets.Add.Name = "New" End If The code is to 1) check the workbook for a sheet name first 2) If the sheet does not exist then add a sheet 3) Name the sheet "New" Is there a better way? TIA Dennis Chip Pearson posted a nice function that you can use (especially nice if you have to this lots of places in your code): Option Explicit Sub testme() If WorksheetExists("New", ActiveWorkbook) Then ...

Creating Distro List Within Address List Group
I have several address list groups defined on my Exchange 2000 server. When I go into Outlook to try and create a new DL to be placed within one of these groups I get the message: "You cannot create entries for this address book" I've given myself permissions on the address group object within Exchange but still get this message. ANY ideas thank you ... ...