Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    20

    Unanswered: Selectively display additional memo fields?

    I'm running a Reporting database for teachers. We have an interface where teachers select their relevant student's record; then their own name from a drop down list; then the subject about which they're writing a comment; and finally, a memo field where they actually write their comment.

    In the case of every subject (except one), there is to be a maximum of 150 words entered for the comment (I'll worry about converting this to a character figure later!) However, there is one subject that demands four to five actual paragraphs of information, and we don't really want to place a word limit there.

    Is there a way to selectively display the additional memo fields ONLY when the value of the drop down list box lkpSUBJECTNAMES is equal to a certain value (SubjectID)? (The data in the dropdown list is sourced from SELECT tblSubjectName.SubjectID, tblSubjectName.SubjectName FROM tblSubjectName)

    Can anyone help here? Thanks!

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Assuming your Memo fields (TextBoxes) already have their Visible property set to False. In the Form's code module for the OnClick event of your kpSUBJECTNAMES ComboBox:

    Your ComboBox is already holding the ID value required for your selection (according to your RowSource Query). It's just a matter of accessing that number and putting it to work. We can gain access to it by using the Column property which is part of the ComboBox structure.


    Code:
    Select Case Me.kpSUBJECTNAMES.Column(0)
       Case 101
          'If the SubjectID is 101 then make the 1st Box Visible.
          Me.MemoTextBox1.Visible = True
          Me.MemoTextBox2.Visible = False
          Me.MemoTextBox3.Visible = False
    
       Case 102
          'If the SubjectID is 102 then make the 2nd Box Visible.
          Me.MemoTextBox1.Visible = False
          Me.MemoTextBox2.Visible = True
          Me.MemoTextBox3.Visible = False
    
       Case 103
          'If the SubjectID is 103 then make the 3rd Box Visible.
          Me.MemoTextBox1.Visible = False
          Me.MemoTextBox2.Visible = False
          Me.MemoTextBox3.Visible = True
    
       Case Else
          'If the SubjectID is different from the ones we want above 
          'then make none of the Boxes Visible.
          Me.MemoTextBox1.Visible = False
          Me.MemoTextBox2.Visible = False
          Me.MemoTextBox3.Visible = False
    End Select
    Usually...Column(0) will hold the Record ID which I'm assuming is SubjectID since this is what you show in your query.

    Make sure the ColumnCount property for your ComboBox is set to 2.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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