Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    64

    Question Unanswered: modify a record on a continuous form

    I have a continuous form, It's for users to browse all the record, then
    1. I would like the use to click one of the record, then it opens a single form related with that record, then users can modify it.
    2. Then in the continuous form reflect the changes.

    How can i achieve this? Any suggestions would be appreciated.

    Thanks in advance

  2. #2
    Join Date
    Nov 2004
    Location
    Bangor, ME USA
    Posts
    44
    this may or may not work but,

    on your continuous form (will work except in datasheet view) create a command button to open your form, in the onclick property do someting like:

    =openupdateinfoform("updateformname", [keyfieldtoretrieve])

    in a module (code) create this function something like:
    Code:
    Public Function openupdateform(Byval FNTU as String, KVTR as String)
    ' FNTU stands for form name to update (form 1a if you will)
    'KVTR stands for Key Value to retrieve (should be a unique value otherwise you could end up on the wrong record without realizing it {the as string on ths can be change to numeric if needed
    
    On Error goto Error_handler
    
    Dim Linkon as string
    
    Linkon = "theform1akeyfieldname = " & KVTR
    With Codecontextobject
    
    DoCmd.OpenForm FNTU, , , Linkon
    'This should retrieve just the one record
    
    End With
    
    Exit_openupdateinfoform:
        Exit Function
    
    Error_Handler:
        MsgBox Err.Description
        Resume Exit_openupdateinfoform
        
    End Function
    Once this works test by just maink sure the update form will open for you. When this part works then on the form you opened create another button (label it Update and Close (or just update if you want a separate close bbutton) My close button function does not need to update another form but I will comment a line that you can uncomment to refesh the Form1 after {[this assumes that form 1 and form 1a use the same datasorce be it a query or table]}

    Code:
    Function Close_Button() 'you may want to pass the form1name to refresh within the () like ByVal FTU as string,
    On Error GoTo Err_Close_Button
    '---------------------------------
    'Closes and saves open form by   |
    'clicking on the close button.   |
    'Found on all Forms in Form      |
    'Header                          |
    '---------------------------------
    
    With CodeContextObject
        .Dirty = False
    '    docmd.refresh FTU
        DoCmd.Close
    End With
    
    Exit_Close_Button:
        Exit Function
    
    Err_Close_Button:
        MsgBox Err.Description
        Resume Exit_Close_Button
        
    End Function
    The commented line may be inacurate as my help files do not work right now. maybe someone else can help you here but these may get you started.

    HTH
    Kevin M Carman

  3. #3
    Join Date
    Mar 2004
    Posts
    64

    modify a record on a continous form

    Thank you very much, Kevin,

    I'll give it a try.

Posting Permissions

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