Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code behind form (2002/sp3)

    I am trying to write the code to open a report and set the query behind it with values in two fields. I can do it with one value but I'm not sure how to code the second field and value.

    My Attempt: DoCmd.OpenReport "rptReportStudentsSortedByGradYear", acViewPreview, , "[none]=0 and [gradyear]= me.txtGradYear"

    The part from and on is what I am not doing correctly I am trying to take a value in a textbox on the form and place it in the [gradyear] field of the query along with a 0 in the [none] field.

    Thanks for the help.

    Paul

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code behind form (2002/sp3)

    Try
    <code>
    ..., "[none]=0 and [gradyear]= " & Me.txtGradYear
    </code>
    This assumes that gradyear is a number field.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code behind form (2002/sp3)

    That worked.

    Thanks Hans!

    Paul

Posting Permissions

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