Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002

    Unanswered: Refresh the Form??

    I have a Listbox control which gets the data thru Query.
    there are some other Attribute fields/labels on the form. i have to show/hide attribute fields & labels according to the no. of data entries in ListBox control.
    e.g (if there are 3 items in Listbox, i have to show 3 attributes).
    i write the code on Form's Current Event which get's the value from Listbox and show/hide the attribute fields properly. but the Problem is when this code assigns the labels/data in these attribute fields, the record has been changed. and when i move to next/previous record without updating any record, the Form's BeforeUpdate Event has been called on which i write the code for asking the user "Do u want to save Changes?". so this box appears everytime even if the user has not changed the record.

    Anybody have some idea how to handle that..


  2. #2
    Join Date
    Nov 2002

    Re: Refresh the Form??

    I had the same issue. I created the following and call it on Form_Current and FormDeactivate. It only stores values from database fields that are visible.

    Public Function FormValues(ByRef frm As Form) As String
    Dim ctl As Control
    On Error Resume Next

    FormValues = ""
    For Each ctl In frm.Controls
    If ctl.Properties("ControlSource") <> "" And ctl.Properties("Visible") = True Then
    FormValues = FormValues & ctl.Value
    End If
    End Function

    Private Sub Form_Current()
    sOldValues = FormValues(Me)
    End Sub

    Private Sub Form_Deactivate()
    sNewValues = FormValues(Me)
    If sOldValues <> sNewValues Then something
    End If
    End Sub

Posting Permissions

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