Multiple conditions on combo box to show different forms

I have a form with a tab subform. I have the below code in the "on current" 
of main form, "after update" of combobox on main form, & "on click" of the 
tab where the subform resides. I'm fairly new to coding. I got the working 
code from reading the discussion groups. 

How would I add an "is null" argument to this code?

Is the "on click" code necessary or am I doing too much?

I want the subform to be blank if the combo box is empty/null (the combo box 
does have a default value).

Select Case Me.Type
        Case "Private"
            Me.Co_Private_Ownership_Subform.Visible = True
            Me.Co_Public_Ownership_Subform.Visible = False
        Case "Public"
            Me.Co_Public_Ownership_Subform.Visible = True
            Me.Co_Private_Ownership_Subform.Visible = False
    End Select

Thank you for your help!!!
0
Utf
12/8/2009 7:53:02 PM
access.formscoding 7494 articles. 0 followers. Follow

2 Replies
1258 Views

Similar Articles

[PageSpeed] 18

cynteeuh wrote:

>I have a form with a tab subform. I have the below code in the "on current" 
>of main form, "after update" of combobox on main form, & "on click" of the 
>tab where the subform resides. I'm fairly new to coding. I got the working 
>code from reading the discussion groups. 
>
>How would I add an "is null" argument to this code?
>
>Is the "on click" code necessary or am I doing too much?
>
>I want the subform to be blank if the combo box is empty/null (the combo box 
>does have a default value).
>
>Select Case Me.Type
>        Case "Private"
>            Me.Co_Private_Ownership_Subform.Visible = True
>            Me.Co_Public_Ownership_Subform.Visible = False
>        Case "Public"
>            Me.Co_Public_Ownership_Subform.Visible = True
>            Me.Co_Private_Ownership_Subform.Visible = False
>    End Select
>

A tab control's Click event is almost worthless.  If you
want ot do something when a tab page is selected, then you
need to use the tab control's Change event.

Then Change event happens regardless of the page that was
selected, so you need to use code to figure out which page
was selected.  Normally a Select Case statement is used for
this:

Select Case Me.tabcontrolname
Case 0
	'code for first page
Case 1
	'code for second page
Case 2
	. . .
Case Else
	MsgBox "no case for " & Me.tabcontrolname
End Select

I think the code for the page where you want to do what you
asked could be something like:

	If Me.Type IsNull(Me.Type) Then
		'do whatever
	ElseIf Me.Type = "Private" Then
		Me.Co_Private_Ownership_Subform.Visible = True
		Me.Co_Public_Ownership_Subform.Visible = False
	ElseIf Me.Type = "Public"
		Me.Co_Public_Ownership_Subform.Visible = True
		Me.Co_Private_Ownership_Subform.Visible = False
   End If
-- 
Marsh
MVP [MS Access]
0
Marshall
12/8/2009 9:06:48 PM
You have at least these two options:

1. Explicitly handle the null before the Select Case.

If IsNull(Me.Type) Then
  'do something here
Else
  Select Case Me.Type
        Case "Private"
            Me.Co_Private_Ownership_Subform.Visible = True
            Me.Co_Public_Ownership_Subform.Visible = False
        Case "Public"
            Me.Co_Public_Ownership_Subform.Visible = True
            Me.Co_Private_Ownership_Subform.Visible = False
    End Select
End If

2. Cover the Nulls under a CaseElse as the last element of the Select (i.e. 
if case does not match any prior case) - if you are certain Null is the only 
other option or are will to treat any other possible options the same as Null:

Select Case Me.Type
        Case "Private"
            Me.Co_Private_Ownership_Subform.Visible = True
            Me.Co_Public_Ownership_Subform.Visible = False
        Case "Public"
            Me.Co_Public_Ownership_Subform.Visible = True
            Me.Co_Private_Ownership_Subform.Visible = False
         CaseElse
            Me.Co_Public_Ownership_Subform.Visible = False
            Me.Co_Private_Ownership_Subform.Visible = False
            'or whatever you wanted here
    End Select





"cynteeuh" wrote:

> I have a form with a tab subform. I have the below code in the "on current" 
> of main form, "after update" of combobox on main form, & "on click" of the 
> tab where the subform resides. I'm fairly new to coding. I got the working 
> code from reading the discussion groups. 
> 
> How would I add an "is null" argument to this code?
> 
> Is the "on click" code necessary or am I doing too much?
> 
> I want the subform to be blank if the combo box is empty/null (the combo box 
> does have a default value).
> 
> Select Case Me.Type
>         Case "Private"
>             Me.Co_Private_Ownership_Subform.Visible = True
>             Me.Co_Public_Ownership_Subform.Visible = False
>         Case "Public"
>             Me.Co_Public_Ownership_Subform.Visible = True
>             Me.Co_Private_Ownership_Subform.Visible = False
>     End Select
> 
> Thank you for your help!!!
0
Utf
12/9/2009 10:33:04 PM
Reply:

Similar Artilces:

Create a list with multiple criteria
I have a data base with 1,000's of addresses w/zipcodes (Sheet 1 columns A to E, E being zipcodes). After setting a base address I get all of the zipcodes within a given radius (in this case 70 zipcodes), listed in Sheet 2, Column A. Next, I use COUNTIF (in column B) to find how many addresses are in each zipcode, in this example there are 46 addresses within the 70 zipcodes. What I want to do is create a list in sheet three that will list each with the data from Sheet 1 columns A to E). Any help would be appreciated. Ronbo ...

Tracking Cases assigned to a different business unit
Hi, We are using the service module in the CRM . I am trying to a keep track of cases that I have assigned to people in different business units in our organization. Has anyone modified the assign popup window to include a tracking (yes/no) field or is there another way ? Thanks! Marc On Feb 17, 10:49 am, Marc Harrington <Marc Harring...@discussions.microsoft.com> wrote: > Hi, > > We are using the service module in the CRM . > > I am trying to a keep track of cases that I have assigned to people in > different business units in our organization. > > Has a...

Removing multiple hyperlinks
I've got data copied into my spreadsheet that includes hyperlinks. Ther are thousands of these in a column. I can remove individually by right-clicking and selecting Hyperlink an Remove. I can then arrow down and do a control Y, cell by cell, What I want to do is highlight the column and be able tp remove th hyperlinks all at once. I've exhausted myself peering through knowlegebases and groups, bu cannot find any way to make this work. Thanks for any input you can provide -- Message posted from http://www.ExcelForum.com Hi one way: Use the following macro to remove hyperlinks...

Show only workdays in chart axis?
Hi, I have created a dynamic named-range that I use as the data source for my scatter plot chart's x-axis. I only type in dates that are workdays in that range. When I graph my data the chart is still showing the weekends, just with no data points in there. It is stretching my graph out and skewing the look. Is there a way to set the graph to only show weekdays and just skip the weekends? Thanks! -Dan I should add I have tried right-clicking on the chart -> chart options -> axes -> and trying to select the Category radio button but it is grayed out, possibly because I a...

Excel different on new machine
I run XP Home with Office 2002 I have just installed my programs to a new machine. Excel is behaving differently on the new machine: Observed so far: i) I cannot select a cell by moving with the arrow keys. ii) I can insert a calculation, SUM for instance, into a cell and I get a 0.00 result. iii) Format > Cells provides three options, Border, pattern and protection. The old machine additionally gave me number, alignment and font. What have I miised? Thanks, Robin Chapple Hi Robin sounds strange to me ... (esp the iii ) ... can you open excel, go to help / about microsoft excel ...

Charting multiple multiples
Hopefully I can explain this in a way that will be understood. Data: Place A Place B Place C FWD Back FWD BACK FWD Back Org_1 1 2 3 2 1 3 Org_2 2 5 4 6 1 4 I would like to place the data so that FWD and Back data is stacked on top of each other in different colors, and placed in one row on a 3-D chart as Org-1 and a second row as Org_2. Any ideas? Thanks. If you arrange your data like this: Back FWD Org_1 Place A 2 1 Place B 2 3 Place C 3 1 Org_2 Place A 5 2 ...

Multiple Hyperlinks In Same Shape Doesn't Work
Can anyone tell me how I can get multiple hyperlinks in the same shape to work? I have no problem inserting the hyperlinks, but they all point to only one. I scoured these posts, and found this (http://groups.google.com/groups?q=hyperlink+group:microsoft.public.visio.*&hl=en&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.visio.*&selm=3eea6467%241%40news.microsoft.com&rnum=2), which doesn't appear to work. Thanks in advance-- RAD Um, which version of Visio are you using? As far as I know, at least Visio 2002 and Visio 2003 support multiple hyperlinks. Can't...

Multiple Profiles, multiple accounts, multiple machine configuring?
Is there a vb or related method of adding *both* profiles *and* email accounts to multiple users logins from the administrator account? I have a network which is a workgroup (NOT a domain), in which there are about 15 users that are replicated on each of 5 machines. I'd like to be able to add all 15 Mail Profiles, and all 15 email accounts to each of the 15 logins on these 5 machines--obviously with as little work as possible. The mail is all retrieved from the same Exchange Server, but these machines *cannot* be added to a domain (don't ask!). I'd hate to have to log into ...

Print Preview only shows in Grey Scale
Hi There, I just got finished creating my letter head in MS Publisher 2003 and when I went to preview it using Print Preview it only shows in Grey Scale. How do I view it in color? Thanks! Does it print in color? Do your other publications show color in print preview? What version Publisher? -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com "Jeff" <anonymous@discussions.microsoft.com> wrote in message news:6dd401c42f4f$73c41a50$a501280a@phx.gbl... > Hi There, > > I just got finished creating my letter hea...

distributing data into multiple cells
hii i have to prepare an exel sheet of some 2000 products..i have to copy d data from the net and then prepare the sheet,with 4 different columns for 4 diff types of entries..now when i copy data nad paste is as text.it all goes in a single cell in a row .how can i distribute the data l into multiple cells????????? -- jaspreet ------------------------------------------------------------------------ jaspreet's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23821 View this thread: http://www.excelforum.com/showthread.php?threadid=374772 can you show some samp...

Single click selects multiple cells
When clicking on a single cell multiple cells are selected. The one time solution for this is to zoom in or out. This is problematic as 60% seems to be the zoom that works most of the time but at this zoom level the cell contents do not display. The time lost and the frustration that builds is killing my productivity and office attitude. Please give all of us a permanet fix. -- Thanks Mike ---------------- 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" butt...

Access to view worksheets with different passwords
I know how to password protect a workbook at the workbook level for viewing and editing. I would like to be able to set up the workbook so that it always defaults to the same tab, and once inside, users can only view the other tabs in the workbook if they have a separate password unique to that tab. Example: The workbook has tabs: "Group Sales Results", "Mark's Sales Results", and "Sandy's Sales Results", where group results are a roll-up of Mark and Sandy's results. How can I structure the workbook so that Mark and Sandy use a common password t...

Order of Events when using the Control Box Close Button
I would like to intercept the built in messages that are generated by Access about required data when a user clicks on the Close Button. The Close Button is enabled by setting the Control Box and Close Button form properties to "Yes". Does anyone know what the order of events is when using the Close Button? Thanks much! Answered in later post. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "accesswanabe" <accesswanabe@discussions.microsoft.com> wrote in message news:E44530CC-48AE-4134-A896-BFC71F032F68@microsoft.com... >I...

Conditional Entry
G'day How do i create a formula for just one cell based on the last entry in a particula row or column? The last entry will obviously change every time i enter a new value in that particaul row or column. eg. Date Value Formula 1/1 15 = 100 MINUS " last entry in value column" (ie. equals 55 on 41, but will change to 66 on 5/1) 2/1 39 3/1 27 4/1 45 5/1 34 6/1 7/1 Cheers B1. Hi! Try this: =100-IF(COUNT(B:B),LOOKUP(9.99999999999999E+307,B:B),0) Biff "Bailua" <b1@nospam.ausdoctors.net> wrote in message...

Is there a way to sort multiple columns with a tab or something?
I have a 4 column spreadsheet. I want to be able to click the heading for each of the columns to hav them sort by that column if clicked. How do I do that -- Message posted from http://www.ExcelForum.com Hi why not used the soprt icon for this. Note: This could screw up your sorting if Excel does not recognize your database columns correctly -- Regards Frank Kabel Frankfurt, Germany > I have a 4 column spreadsheet. > > I want to be able to click the heading for each of the columns to have > them sort by that column if clicked. How do I do that? > > > --- > Mess...

no "today" in mail box
some times my email folder does not show "today" whilst showing "yesterday" and other dates. Where is it? Because you haven't received mail today yet? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Michel" <anonymous@discussions.microsoft.com> wrote in message news:99db01c48682$29a02c90$a401280a@phx.gbl... > some times my email folder does not show "today" whilst > showing "yesterday" and other da...

CRM and Exchange in different domains
Is there a way for a CRM 3.0 server to intergrate with an Exchange server in another domain? ...

Sending to multiple addresses
How do I send an email to multiple addresses having only the recipient see their own email address? Michelle wrote: > How do I send an email to multiple addresses having only > the recipient see their own email address? Put the addresses into the BCC: field. Note that many e-mail programs will decide such mails are spam though. >-----Original Message----- >How do I send an email to multiple addresses having only >the recipient see their own email address? >. Open your new email and go to tools, select recipient, when your address book opens select (highlight) the a...

multiple selection
How can I select multiple records into a list box? I want that for append identical records (for select records) in another table. Many thanks Florin Use a subform instead of a list box. In a subform bound to a related table, you can append as many rows as applicable. It is possible (but not simple) to use an unbound multi-select list box that is populated in the Current event of the form, and executes Append, Delete, and Update query statements based on the ItemsSelected if they are changed. You will also have to find a way to respond to the user "undoing" changes. -- Al...

Exchange 2000 Distribution Lists
Hello We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5 Is there any way to configure multiple people to be owners or editors of the distribution lists? This was possible in 5.5, but we cannot find a means of accomplishing this in 2000 Any help would be appreciated Thank yo Jason "Jason P.S." <jason.pruden-shebaylo@investorsgroup.com> wrote: >We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5. > >Is there any w...

How to hide form from grid 2 to 4
I have a form that I’m using as main form menu, I need three different portions to be able to hide and view. I know how to hide acDetail section, Heared or footer but do not know how to hide a potion of the form only, i.e.: on detail section hide form from grid 2 to 4. Any help, tip or comment is greatly appreciated, Adnan hi Adnan, Adnan wrote: > I have a form that I’m using as main form menu, I need three different > portions to be able to hide and view. I know how to hide acDetail section, > Heared or footer but do not know how to hide a potion of the form only, i.e.: >...

Need to have a dropdown list containing multiple rows
I am setting up an form and need to create a dropdown list that will contain 8 sets of data. Each set needs to contain 3 rows of data (name, street address & city/state/zip. The goal is to allow the user to click onto the cell, see the dropdown and select which address set to use. This would then place the data into three rows suitable for mailing. I have never attempted anything like this and am in need of assistance. Thank you. --- Message posted from http://www.ExcelForum.com/ Pat What you ask is easily done using Data Validation drop-down list and a few Vlookups but........Ex...

Combine multiple tables into one
I took over a database in which the last person created a new table for everyday worth of data (ie. Feb-21-08 is named 022108). There are over 100 tables in the single database with the same columns and table attributes, I would like to combine all of these tables into one where I have a Date_Key field in place of the table name. I figured out how to query the table names using the following: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Now I j...

Multiple domains #6
Hi, Having done some research I have found that it is possible to send and receive email from multiple domains with Exchange 2003. I have a few questions that I would like cleared up if anyone can help. 1. Is it really as simple as configuring a recipient policy for the new domain and then changing the mail record for that domain to point to the proper IP address? 2. If I set up a new account in AD, and need this account to be associated with the second email domain, will the default SMTP email be for the first domain? If so, can I just edit this directly? 3. If I set the default SMTP add...

forwarding mail to multiple external addresses
I have a user on our Exchange Server 2003 that wants his email to be forwarded to 2 different external email addresses and not have the original mail stored in his exchange mailbox at all. I can set this up to froward to only one external email address by creating a contact in Active Directory with an external email address and then forwarding to that contact. However, it won't allow me to forward to multiple contacts. Please help as this seems like a pretty common request from several users. I'm not sure, as I haven't tested it before, but you might be able to create a ...