Text Properties Change based on New Entries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • legteg
    New Member
    • Mar 2010
    • 5

    Text Properties Change based on New Entries

    I'm new to Access and VBasic and have been thrown into a pretty big project so needless to say I am having difficulties. I have developed a big project (regarding my knowledge level) and need to track data from month to month.

    Is there a way to create a control that will refer to the previous month and if for example, a project name, has not been entered, it will display the name in the form as bold and a different color? Then in the following month, if the project name is determined to exist, it goes back to regular text? Any help is greatly aoppreciated!!! !!!!
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    you will probably need to explain a little better....
    you mention project names being entered but don't say where this project name is to be entered (a field in a table, a control on a form, etc.) and you mention a previous month but previous from what? the current month,the month from a record in a table, from selected date in a control? you mention a "Name" but make no indication as to what this mysterious "Name" thing is.

    what I'm getting at is if you could clearly explain what objects you are dealing with (forms, textboxes, comboboxes, tables, queries, etc. and explain just what it is you are trying to have these objects do. Then we might be in a position to understand a little more.

    Comment

    • legteg
      New Member
      • Mar 2010
      • 5

      #3
      Sorry . . . I realize that I didn't give much to work with. I have a form, that tracks scores for the success of a course evaluation each month. When I open the form, I enter the name of the course and then the score received which writes to a table. Since many of the courses remain the same each month, I have added a feature that when I return the next month to enter that months scores, I am asked if I want to copy the course list from last month (to save time). When I say yes, the course names only copy into the form for the present month, but no scores copy forweard.

      I have set start dates and end dates (start of month and end of month) in the table for referencing when the course started for the first time. My goal is to have the form check a new record entry (not copied over from the previous month but entered in the current month) to be added to the table (which works) and the start date registers as the current month day 1 (ie: Mar 1 and end date Mar 31 - this works too). I did this because of the reporting periods which are for the entire month regardless of actual day whithin the month.

      What I would like to do is have the a macro (or querry, still al newbie onm these) recognize when I added a new record based on the start date field, determined by there being no prior course matching the name, to make the text in the field bold and red. Then when the record appears next month in the form (as copied forward) it will not be bold because as the form write these new records to the table, it will reference the name and start dates and if it finds previous matches, it will be regular text.

      I hope this helps a little more in what I want to achieve if possible. I can try and explain in more detail if necessary. Thanks so much for the attention!!!!!

      Comment

      • legteg
        New Member
        • Mar 2010
        • 5

        #4
        Yarbrough40-

        Would it make more sense for me to create a field in my table, that based on the date, displays a Y or N (referring to the new course) and then have the bold red text based off of a statement using the Y or N as the controller?

        I'm sorry if the way I explain this is confusing. I'm trying to be as clear as possible but I'ma newbie at this. Thanks ;-D

        Comment

        • yarbrough40
          Contributor
          • Jun 2009
          • 320

          #5
          your last suggestion is definately the better route to go. just have all those fields default to yes unless you are entering a new one on the form - then it's no.

          Comment

          • legteg
            New Member
            • Mar 2010
            • 5

            #6
            Am I on the right track here or am I waaaaay oofffff (which I feel like). I have added this code in reference to the courseName field on my form.

            Table Name: wbtCOURSEListTB L
            Field Name: new (Y or N)

            Private Sub courseName_Befo reUpdate(Cancel As Integer)

            If wbtCOURSEListTB L.new = N Then
            wbtCOURSEListTB L.new.FontName = Arial
            Else
            wbtCOURSEListTB L.new = Y
            wbtCOURSEListTB L.new.FontName = ArialBlack

            End If
            End Sub

            Comment

            • yarbrough40
              Contributor
              • Jun 2009
              • 320

              #7
              yes but you need to call a function of some kind to talk to your table and give it criteria... DLookup should do the trick. You'll need to tweak it a bit to match your stuff exactly.

              also there may be a better event to use than BeforeUpdate. You'll have to play around with that.
              Code:
              Dim NewCourse as String
              NewCourse = DLookUp("[new]", "wbtCOURSEListTBL", _ 
                     "[CourseName] = " & TheNameOfMyForm![TextBox1]") 
              
              If NewCourse = "N" Then
              Me.TextBox2.FontBold = True
              Me.TextBox2.ForeColor = vbRed
              Else
              Me.TextBox2.FontBold = False
              Me.TextBox2.ForeColor = vbBlack

              Comment

              • legteg
                New Member
                • Mar 2010
                • 5

                #8
                Thanks - I'll give it a whirl.

                Comment

                Working...