#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0

    Comparing Two Values


    If Form_Prospects_Restrictions.Value > Communication_Number.Value Then
    MsgBox "Restricted"
    Else
    Communication_Date.Value = Format(Now, "mm dd yy")
    End If

    the 2 values i am comparing are from different forms. one a parent form (prospects) and one a subform (communication).
    i am getting the error message "object required". how can i make the form (communication) recognize the restrictions field from the prospects form? is this the problem? thanks.

    ameen
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    31
    Rep Power
    12
    try this:

    if your are referring to a control on a form i believe you need to call it as in

    MyForm.MyControl.Value
    if its a text box i think it should be

    MyForm.MyControl.Text

    ....however you may have to set focus first on the relevant controls to get the value.

    dim val1 as String, val2 as String

    MyForm.MyControl.SetFocus
    val1 = MyForm.MyControl.Value

    MyForm.MyControl.SetFocus
    val2 = MyForm.MyControl.Value

    then do your comparison with val1 and val2.

    hope that helps....if thats what you were trying to accomplish.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    31
    Rep Power
    12
    sorry forgot to mention this:

    If(val1 > val2) Then
    MsgBox "Restricted"
    Else
    ............ Relevant code here

    End If
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0
    thank you very much.

IMN logo majestic logo threadwatch logo seochat tools logo