Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: Pasing variable from Continuous Forms to another form

    Hiya

    I have 2 tables one contains raw book data and is changed on a daily basis. The second contains comments on the books and is not overwritten.

    I have a form that displays all data using Continuous Forms (Table 1). I chose this method so that i can place a button next to each record that creates a new record in a comments table (Table 2).

    When we create a new comment, we use the ISBN from the raw data as the key and add the comments. This makes up a new record in table 2.

    Is there a way to pass the ISBN varibale from the Continuous Form record to the form i use to create the new comment?

    Cheers
    gand

  2. #2
    Join Date
    Feb 2004
    Posts
    142
    A simple way to do this is to create a hidden text box on the second form and on the button click event add code to place that value in the second form after you open it.

    If you need to take some action on this value by the second form then create a public function in the second form's code module and call it after the form is opened.

    public function SecondFormAction(passed_value as some datatype)
    'do action
    end function

    Call it from first form

    Private sub button_Click()
    open form
    call forms!SecondForm.SecondformAction(Passed_Value)
    end sub
    KC

  3. #3
    Join Date
    Feb 2004
    Location
    Houston, Texas
    Posts
    45
    ... or just pass the value using the OpenArgs property on the docmd.openform. then refer to it using me.openargs in the second form.
    ...rtk

  4. #4
    Join Date
    Feb 2004
    Posts
    142
    Originally posted by rtkracht
    ... or just pass the value using the OpenArgs property on the docmd.openform. then refer to it using me.openargs in the second form.
    ...rtk
    Oh sure, do it the easy way
    Heres the example in the ms help

    Sub OpenToCallahan()
    DoCmd.OpenForm "Employees", acNormal, , , acReadOnly, , "Callahan"
    End Sub

    Sub Form_Open(Cancel As Integer)
    Dim strEmployeeName As String
    ' If OpenArgs property contains employee name, find corresponding
    ' employee record and display it on form. For example,
    ' if the OpenArgs property contains "Callahan", move to first
    ' "Callahan" record.
    strEmployeeName = Forms!Employees.OpenArgs
    If Len(strEmployeeName) > 0 Then
    DoCmd.GoToControl "LastName"

    DoCmd.FindRecord strEmployeeName, , True, , True, , True
    End If
    End Sub
    KC

Posting Permissions

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