Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: Passing form data to Access query

    This seems simple enough but I can't figure it out.

    I have a series of queries - maybe 15 in all. Each has a field as follows:

    Field: Net: ([DB_amount_11]+[cr_amount_11])
    Total: Sum

    Each month I have to manually change the Net field to reflect the current month. ([DB_amount_12]+[cr_amount_12])

    What I tried to do without success is create a form so I could change the month just once (on the form) and the queries would all update.

    When I do this, instead of getting a value in the Net field, I get:
    "([DB_amount_12]+[cr_amount_12])"

    The question: is there a way to do this in the query design window? Or do I need to do this using VBA/SQL.

    Thanks in advance for your assistance - I appreciate it

    Dennis

  2. #2
    Join Date
    Nov 2003
    Posts
    267
    What I would do is set up my queries so that on the form I enter which month I want and have the data pull formt he different fields that relate to the month I chose.

    In you if statemtn you would look at the value you passed to the query and..


    Select iif([forms]![frmName]![Fieldname] =11, (Table1.[DB_amount_11]+Table1.[cr_amount_11]), [forms]![frmName]![Fieldname] = 12, (Table1.[DB_amount_12]+Table1.[cr_amount_12]), 0))as Net
    From Table1


    I will let you work out the proper syntax, but it isn't to hard.

    S-

Posting Permissions

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