• Update Form (2002)

    Author
    Topic
    #390202

    Hey Gang,

    I have a Form for reviewing data in a table with an update button that opens a pop up form for adding and or modifying the data in the table. The problem I am having is that when the update for Pop’s up it defaults to the first record. I want it to stay on the record the user was reviewing when they hit the update button. I cannot for the life of me find the code that keeps the record the same.

    Any help would be appreciated.

    Dan

    Viewing 0 reply threads
    Author
    Replies
    • #692221

      Do you want all records to be visible in the popup form, with the current record on the calling form as the current record in the popup form too, or do you want the popup form to display only the “current” record?

      • #692223

        I want the popup form to open up to the current record on the calling form.

        • #692229

          I’m sorry, that is not an entirely unambiguous answer to my question.

          • #692231

            I want all records to be visible in the popup form, with the current record on the calling form as the current record in the popup form too.

            Sorry about the vagueness.

            Dan

            • #692234

              Thanks for clearing that up. You need a unique identifier for the current record; an AutoNumber field is ideal for this, but it can also be another type of field, or even a combination of fields. In the example below, I have assumed that you have a numeric field ID that acts as unique record identifier. The On Click code for the update button could look like this, with the appropriate names substituted.

              Private Sub cmdUpdate_Click()
              DoCmd.OpenForm FormName:=”frmPopup”, WhereCondition:=”[ID]=” & Me.[ID], WindowMode:=acDialog
              End Sub

              If the ID field is text, the value must be enclosed in quotes: use “[ID]=” & Chr(34) & Me.[ID] & Chr(34) as WhereCondition. Chr(34) is the code for the double quote “.

    Viewing 0 reply threads
    Reply To: Update Form (2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: