Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    47

    Unanswered: Min ans Max values

    Hi,

    I am trying to find min and max values of set of 6 values and then find the difference. If the diff is greater than < 15 the "adjsaleprice" should show yes else should show no. I have the below code. When I try to test it the "adjsaleprice" deosn't show any value.

    Private Sub Adjustedsaleprice()
    Dim Themin As Double
    Dim Themax As Double
    Dim Thediff As Double

    Themin = min(Me.comp1_AdjPrice, Me.comp2_AdjPrice, Me.comp3_AdjPrice, _
    Me.comp4_AdjPrice, Me.comp5_AdjPrice, Me.comp6_AdjPrice)

    Themax = max(Me.comp1_AdjPrice, Me.comp2_AdjPrice, Me.comp3_AdjPrice, _
    Me.comp4_AdjPrice, Me.comp5_AdjPrice, Me.comp6_AdjPrice)

    Thediff = (Themax - Themin) * 100 / (Themin)

    If Thediff <= 15 Then
    Me.adjsaleprice = "yes"
    ElseIf Thediff > 15 Then
    Me.adjsaleprice = "no"
    End If

    End Sub

    Private Sub comp6_AdjPrice_AfterUpdate()
    Call Adjustedsaleprice
    End Sub

    Thanks,
    Last edited by ujjwala; 03-21-07 at 17:48.

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Look at Access help "Dmin", "Dmax" functions.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Just out of interest could you explain the following line?
    Code:
    Thediff = (Themax - Themin) * 100 / (Themin)
    Also, a quick hint on debugging.
    Use breaklines throughout your code and hover your mouse over your variables etc to see their values.
    Alternatively you can use Quick Watches along with breaklines to monitor the values of items. To do this - highlight a word and use 'Debug' > 'Quick Watch...' (or shift + F9).
    This way you could see why "adjsaleprice" was not obtaining a value.
    George
    Home | Blog

Posting Permissions

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