combobox, textbox-synchronization ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zlatko Matiæ

    #1

    combobox, textbox-synchronization ?


    I have several forms hierarchycaly nested in each other
    (form/subform/subform/subform....).
    The final form is "continous form", while parent forms are single forms
    through which navigation was performed by navigation buttons.
    Now I want to enable navigation through records both by navigation buttons
    and COMBOBOXES. Therefore I added comboboxes besides textboxes.
    Let's suppose that txtAAA is textbox and cbxAAA is cmbobox. My aproach was
    following:


    ' Events on the form:

    ' 1. On Load event fills combobox with the first value

    Private Sub Form_Load()
    cbxAAA = cbxAAA.ItemData (0)
    End Sub

    ' 2. On Current event synchronizes combobox value with current record in the
    form (represented by txtAAA)

    Private Sub Form_Current()

    Me.cbxAAA.Reque ry

    For i = 0 To cbxAAA.ListCoun t
    If cbxAAA.ItemData (i) = Me.txtAAA Then
    Me.cbxAAA = cbxAAA.ItemData (i)
    Exit For
    End If
    Next i

    End Sub

    ' On the COMBOBOX istelf we have After Update event which synchronizes
    current record (txtAAA)
    ' with the value selected from the combobox.


    Private Sub cbxAAA_AfterUpd ate()

    With CodeContextObje ct
    DoCmd.GoToContr ol "txtAAA"
    DoCmd.FindRecor d .cbxAAA, acEntire, False, , False, acCurrent, True
    End With

    End Sub


    This works perfectly as long as both textbox and combobox are visible. But,
    my intenion was to hide textbox.
    Unfportunately, when I put property txtAAA.Visible= False, the above
    mentioned After Update event generates an error, because Find method
    requires an object focus and hidden object can't have focus...
    What is the alternative solution ?

    Thanks.





  • Madhivanan

    #2
    Re: combobox, textbox-synchronization ?

    try to make it locked instead of hiding

    Madhivanan

    Comment

    • Zlatko Matic

      #3
      Re: combobox, textbox-synchronization ?

      No problem with that...but I want it to be invisible...

      "Madhivanan " <madhivanan2001 @gmail.com> je napisao u poruci interesnoj
      grupi:111105083 9.597104.143010 @o13g2000cwo.go oglegroups.com. ..[color=blue]
      > try to make it locked instead of hiding
      >
      > Madhivanan
      >[/color]


      Comment

      Working...