Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    66

    Red face Unanswered: Set value before opening a report?

    Hi,

    I'm trying to open a form to a specific record. I use the query that this form is based on for another form as well, so it asks a question, Enter the Month (as sometimes we view a whole month at a time. In the form I'm working on, I open the new form based on a specific date, so the month is already predetermined. I tried this:

    Private Sub ViewMenufromUpdateDates_Click()
    On Error GoTo Err_ViewMenufromUpdateDates_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "MealDate"

    stLinkCriteria = "[MealDateID]=" & Me![MealDateID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_ViewMenufromUpdateDates_Click:
    Exit Sub

    Err_ViewMenufromUpdateDates_Click:
    MsgBox Err.Description
    Resume Exit_ViewMenufromUpdateDates_Click

    End Sub

    But somewhere in there, need to tell it that
    [Enter the Month] = Month(mealdate)

    Anyone know how (where) I do this? I tried using setvalue but I can't figure out how to make that work.

    Thanks a ton!

    Susie

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Can you copy the query, remove the parameter question from the copy, set criteria to get the month date range you need and use that to open the form?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Apr 2004
    Posts
    66
    I guess that's what I'll have to do! Thanks!

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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