Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Posts
    4

    Unanswered: Advice on conditional operation in Access 2007

    Hi,

    I'm using Access 2007 to create a database that tracks various data from academic articles. Some of our questions include information regarding the race/ethnicity of the articles' subjects. For example, an article might be on Latinos or African Americans. So one column in our table is "Does the article break down based on racial/ethnic group?" I have this column set to be answered "Yes/No." What I would like to do is, if the article does condense down to race, have a separate selection to pop out for the database manager to be able to input which race (White, Black, Latino, Asian etc.) and then once one of the races is selected for the database manager to be able to input how many people of that race was in there (so another selection is made available). If the article does not break down into race, I'd like to have No selected and nothing happen (i.e. no race options pop out).

    I fooled around with the expression builder and the IIF feature by myself, and dabbled in some Access books, but did not get far and couldn't figure out which would make the data input more efficient and streamlined. I would appreciate any help. Please let me know if I need to be more specific.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Try this type of thing, in the after update event of the first control:

    Code:
    If Me.FirstControlName = "Yes" Then
      Me.SecondControlName.Visible = True
    Else
      Me.SecondControlName.Visible = False
    End If
    Paul

  3. #3
    Join Date
    Feb 2009
    Posts
    4
    Quote Originally Posted by pbaldy
    Try this type of thing, in the after update event of the first control:

    Code:
    If Me.FirstControlName = "Yes" Then
      Me.SecondControlName.Visible = True
    Else
      Me.SecondControlName.Visible = False
    End If
    I appreciate the quick response. We are working with both the original table I used to make the form. I applied the code you posted as an after update event for the form Does it break down sample by race, ethnic groups label from my original table. After putting in the code in Microsoft Visual Basic, I tested it out and when I enter yes in the field, the race options do not become visible. I really appreciate the help. I'm going to post a portion of my code so as not to create too much clutter here. Could someone tell me where I erred? Note: I modified this off the top of my head to show what I "think" I'm trying to accomplish, so the following isn't the real code.

    Private Sub Does_it_break_down_sample_by_race___ethnic_groups_ __Yes_No__AfterUpdate()
    If Me.Racial_Ethnic_Composition = "Yes" Then
    Me.Non_Hispanic_White.Visible = True
    If Me.Non_Hispanic_White.Visible = "Yes" Then
    Me.Number_of_subjects_and_percent_of_sample.Visibl e = True
    Me.Hispanic.Visible = True
    If Me.Hispanic.Visible = "True" Then
    Me.Number of subjects and percent of sample.Visible = True
    Else
    Me.Racial_Ethnic_Composition.Visible = False
    End If
    End Sub

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    That may not be the longest name ever, but it's a contender.

    I would expect that in the after update event of the control(s) you're testing, not the form. The after update event of the form won't fire until you're done with that record. Depending on your circumstances, you may also want it in the current event to handle record changes.

    Also, there's a difference between "True" and True. When testing the Visible property, you'd want the second:

    If Me.Non_Hispanic_White.Visible = True Then
    Paul

  5. #5
    Join Date
    Feb 2009
    Posts
    4
    I again appreciate the help. I shortened up the title and made adjustments to the syntax, but I still haven't been able to get the command to work. Do you know of any sites where I might find a sample Access DB that shows me an example of how you can make an Access table kick out additional options once you select Yes (but otherwise make this additional options invisible if the person selects No)? Thanks again.

  6. #6
    Join Date
    Feb 2009
    Posts
    4
    Quote Originally Posted by nightdev
    I again appreciate the help. I shortened up the title and made adjustments to the syntax, but I still haven't been able to get the command to work. Do you know of any sites where I might find a sample Access DB that shows me an example of how you can make an Access table kick out additional options once you select Yes (but otherwise make this additional options invisible if the person selects No)? Thanks again.
    I was thinking I could clarify a little bit because I'm probably unclear. Do I need to already have columns for each race (African American, Hispanic etc.) in order for this to work? I am basically moving from a very simple table that just has column headings of like Author Name, Year Published etc. and then making a form from that and doing the conditional formatting through the form. Do I need to create "suboptions" for each column. For example, I don't know how have the user able to pick options from each column. So if I have a column that says "What race does this article focus on?" can I have "suboptions" for the user to pick a race? I feel like that's what missing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •