Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am going to attach a sample of the database i am working with. I am concerned with the "Platelet x10 3rd" and WBC fields. Depending on what value is entered i want the field to turn a certain color. It seems to work and then i will enter a 6 or 1 or something that i am expecting to be one thing and the color turns red.

    Here is some of the code:
    Private Sub Platelet_x10_3rd_AfterUpdate()

    If [Platelet x10 3rd].Value >= "500" Then
    [Platelet x10 3rd].BackColor = vbRed
    Else

    If [Platelet x10 3rd].Value <= "150" Then
    [Platelet x10 3rd].BackColor = vbYellow
    Else

    [Platelet x10 3rd].BackColor = vbWhite

    End If
    End If


    End Sub



    Or this has the same issues (I enter a 6 and it turns red):

    If [WBC].Value >= "12" Then
    [WBC].BackColor = vbRed
    Else
    [WBC].BackColor = vbWhite
    End If

    Is there something wrong with the format of the actual field?

    Thanks for any help you can provide.
    Attached Files Attached Files

  2. #2
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have been messing with this some more and was able to put the "real" conditional formatiing on the boxes and took that code out of the afterupdate event. But now i want my print box to show when the field is red or yellow so i can then print that current record.

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='lkr1219' post='764690' date='10-Mar-2009 21:36']But now i want my print box to show when the field is red or yellow so i can then print that current record.[/quote]
    Your conditional formating in the report should be the same as in the mainscreen.
    And you have to change the property Back Style from the textbox [Platelet x10 3rd] to Normal.
    Francois

  4. #4
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Francois' post='764698' date='10-Mar-2009 21:12']Your conditional formating in the report should be the same as in the mainscreen.
    And you have to change the property Back Style from the textbox [Platelet x10 3rd] to Normal.[/quote]


    You will have to forgive me - i have been away from the programming of Access for a while now.
    Why do i need to have conditional formatting on the report?
    What does changing the property Back Style to Normal do?
    Before when i had my conditional formating in code i made my command button for printing visible or not visible based on the color of the text box. It was just not being very consistent. Is there no way to still do this?
    Thanks

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='lkr1219' post='764737' date='11-Mar-2009 01:46']Why do i need to have conditional formatting on the report?
    What does changing the property Back Style to Normal do?
    Before when i had my conditional formating in code i made my command button for printing visible or not visible based on the color of the text box. It was just not being very consistent. Is there no way to still do this?[/quote]
    You need conditional formating on the report to have the textbox [Platelet x10 3rd] colored in red or Yellow.

    Back Style was set to Transparent. In Transparent you can't see a back ground color. So you have to set it to Normal.

    I would use the same condition (>= 500 and <=150) for making PrintCurrentEntry button visible or not. But you have to set the visible for every condition. Here is the code
    Code:
    If [Platelet x10 3rd].Value >= "500" Then
    	[Platelet x10 3rd].BackColor = vbRed
    	Me.PrintCurrentEntry.Visible = True
    ElseIf [Platelet x10 3rd].Value <= "150" Then
    	[Platelet x10 3rd].BackColor = vbYellow
    	Me.PrintCurrentEntry.Visible = True
    Else
    	[Platelet x10 3rd].BackColor = vbWhite
    	Me.PrintCurrentEntry.Visible = False
    End If
    You should enter the code int the On Current Event of the form AND in the After Update Event of textbox [Platelet x10 3rd].
    Francois

  6. #6
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My field with the [Platelet x10 3rd] seems to be working fine. But i am still missing something in the [WBC] field. I want anything above 12 to flag as red. I put 6 in and it flags red. I put a break on the AfterUpdate of WBC and it sees the value as 6 but it still falls into the if statement and turns it red. I am sure it is something simple i am missing here but don't know what.

    Thanks for all your help with this.

    I have attached a new copy of the database.
    Attached Files Attached Files

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='lkr1219' post='764794' date='11-Mar-2009 14:00']But i am still missing something in the [WBC] field. I want anything above 12 to flag as red. I put 6 in and it flags red.[/quote]
    I removed the conditional formatting for the WBC textbox because it was wrong. And in the code I remove the double quotes around 12 so it is compared as numeric (and around the 500 and the 150). With quotes it is compared as text.

    [attachment=82782:testing_trima.zip]
    Attached Files Attached Files
    Francois

  8. #8
    Lounger
    Join Date
    Sep 2005
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Francois' post='764804' date='11-Mar-2009 14:42']I removed the conditional formatting for the WBC textbox because it was wrong. And in the code I remove the double quotes around 12 so it is compared as numeric (and around the 500 and the 150). With quotes it is compared as text.

    [attachment=82782:testing_trima.zip][/quote]



    Thanks for all your help!!!

    May be back later with a whole other project.

Posting Permissions

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