How to prevent the overlapse range entry ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chinfk
    New Member
    • Oct 2007
    • 15

    How to prevent the overlapse range entry ?

    Hi There,

    I hav a entry said order serial no from 001 - 700, in the QA approval entry for this range no could be partial.

    Less said 1st lot - (001 - 100), 2nd lot - (300 - 420) and so on.
    How to prevent user to key in 050 - 070 or something are in within the previous entry ?

    I had manage to limit the entry from 001 - 700, but in between that overlapse is had to control.

    Any suggestion on control this? Thanks in Advance. =)
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hi, there.

    Take a look at Iif query thread.
    The question there was just the same but with time intervals instead of your's numeric intervals.

    Regards,
    Fish

    Comment

    • chinfk
      New Member
      • Oct 2007
      • 15

      #3
      Hi Brother FishHal,

      Thanks for your helps and i have modify to what my program needs, it works definitely.

      Thanks and wish you have a nice day ya!

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        :)

        Glad you've got it work.
        Have a nice day too, and all subsequent days even more nice.

        Best regards,
        Fish

        Comment

        • chinfk
          New Member
          • Oct 2007
          • 15

          #5
          Hi Brother Fish,

          There is the loop hole in my program which it can detect the overlapse range
          But for the value that smaller or larger than the current range of data, it can't
          allow that.

          My code as below:

          If DCount("[ID]", "Temp-QA2", "((str(SN) > " & .SN & " And str(SN) < "
          & .EN & ")

          OR (str(EN) > " & .SN & " And str(EN) < " & .EN & ")
          OR (str(SN) <= " & .SN & " And str(EN) >= " & .EN & ")) <> 0 ") Then
          Me.Undo
          Me.SN.SetFocus
          ValidateSerialN oSlot = False
          ElseIf DCount("[ID]", "Temp-QA1", "((str(SN) < " & .SN & "
          And str(SN) < " & .EN & ")
          OR (str(EN) < " & .SN & " And str(EN) < " & .EN & ")) > 0 ") Then
          ValidateSerialN oSlot = True
          End If

          Let said the order range is from 001 - 700.

          1st line item - 005 - 100
          2nd line item - 001 - 004 ( cannot key) or 101 - 300 ( cannot Key also)

          But if 2nd line item - 006 - 099 ( it detect error = false)
          - 004 - 099 ( it detect error = false)
          - 003 - 099 ( it detect error = false)

          Please help to look into my code why it cannot allow to key value that
          smaller or larger than the current set of data,

          Thanks very much in advance. =)

          Comment

          • FishVal
            Recognized Expert Specialist
            • Jun 2007
            • 2656

            #6
            Hi, chinfk.

            You don't need to convert table field numerical value to string in order to compare it with TextBox.Value. TextBox.Value property returns Variant type variable.
            Moreover if you convert table field value from numerical type to string comparison rules change to those for strings (char by char comparison from left to right until operand1 char <> operand2 char).

            Example:
            123 > 98 = True
            but
            "123" > 98 = False
            "123" < 98 = True

            Comment

            • chinfk
              New Member
              • Oct 2007
              • 15

              #7
              Hi Brother FIsh,

              The order no range will consist of alphanumeric value, so i had to string it else will get data type mismatch error.

              Comment

              • FishVal
                Recognized Expert Specialist
                • Jun 2007
                • 2656

                #8
                Originally posted by chinfk
                Hi Brother FIsh,

                The order no range will consist of alphanumeric value, so i had to string it else will get data type mismatch error.
                ?

                Plz, translate it to English. :)

                Comment

                Working...