Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    103

    Unanswered: Referring to a subform

    Can anyone see what's wrong with my code?

    Code:
    If Date >= [Forms]![Frm_RNO]![SubFrm1].Form![Sub1STDate] And Date <= [Forms]![Frm_RNO]![SubFrm1].Form![Sub1EDDate] Then
    Me.ThisAmnt= [Forms]![Frm_RNO]![SubFrm1].Form![Sub1Amount]
    Else
    If Date >= [Forms]![Frm_RNO]![SubFrm2].Form![Sub2STDate] And Date <= [Forms]![Frm_RNO]![SubFrm2].Form![Sub2EDDate] Then
    Me.ThisAmnt= [Forms]![Frm_RNO]![SubFrm2].Form![Sub2Amount]
    End If
    End If
    Using Access 2010.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    nope
    what error message are you getting, and on which line
    have you stepped through the code to see what is actually happening
    it could be that your use of reserved words is causing grief
    https://www.google.co.uk/#hl=en&scli...w=1366&bih=681
    it may be smarter to use the between operator
    you may need to explcitly convert the value from the control to a date value using the cdate function
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2011
    Posts
    103
    I'm not getting any error. The field just doesn't do anything as if there's no code behind it. I've checked to make sure that data should be populating in the field. I will try Between operator. Maybe that'll work... Cdate is good suggestion too.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so is the code running or not
    what is going wrong / not happening
    have you placed a watch on the code to see if it is running
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Nov 2011
    Posts
    103
    Actually I think it's cause of Null values... I'm not very good with these. How would I account for the null values in my fields?

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    look up isnull, coalesce, NULL handling
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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