Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jan 2001
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have database that keeps track of budget amounts - here are my tables:

    Budget Amount - contains the total budget and the year for that budget
    Staff
    Requested - amount requested, department
    Category
    Department
    Paid - amount paid, category of payment

    I have a Menu form where I want the user to pick the year that they are working in.
    They then open another form from the menu that will update the paid table.
    I want the second form to display the correct year that was chosen on the original menu form.
    This form is based on a query and pulls up records based on the staff member chosen in a combo box.
    The user then fills out the second form with the paid information.
    When they click the save record button, I want the table to be updated with all the information that has been entered including the Year.
    I can update the rest of the table just fine using both text fields and combo boxes but I can't figure out how to get the year to update.
    Does this make sense and is it possible?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Will the user edit existing records in the second form or create a new record?


  3. #3
    Lounger
    Join Date
    Jan 2001
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    Will the user edit existing records in the second form or create a new record?
    The user will create a new record in the table Paid. That record is tied to a record in the Requested table - so the query pulls up all the requested items for a particular staff member - the user selects appropriate record and adds the new paid information to the paid table. Does that make sense?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can pass the year in the OpenArgs argument of DoCmd.OpenForm, for example:

    DoCmd.OpenForm FormName:="frmPaid", OpenArgs:=Me.Year

    In the On Load event of the form being opened (frmPaid in the above example), set the default value of Year:

    Code:
    Private Sub Form_Load()
     If Not IsNull(Me.OpenArgs) Then
      Me.Year.DefaultValue = Me.OpenArgs
     End If
    End Sub

  5. #5
    Lounger
    Join Date
    Jan 2001
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    You can pass the year in the OpenArgs argument of DoCmd.OpenForm, for example:

    DoCmd.OpenForm FormName:="frmPaid", OpenArgs:=Me.Year

    In the On Load event of the form being opened (frmPaid in the above example), set the default value of Year:

    Code:
    Private Sub Form_Load()
     If Not IsNull(Me.OpenArgs) Then
      Me.Year.DefaultValue = Me.OpenArgs
     End If
    End Sub
    Thank you - Lovely!!!

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    As an alternative to the solution that Hans suggested, you might consider the possibility of making Form 2 a subform on your Menu form. Subforms will link automatically if you create the appropriate linking fields between the main form and the subform, and the records will save automatically without the user having to click a Save button. Just some food for thought...
    Wendell

Posting Permissions

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