Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Jul 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Updating Forms from Control (2003)

    Hi Folks. I have a form frmSwitchboard in which I wish to place a box FrmFieldsSub. I want to update the FieldName value in FrmFieldsSub dependant upon selecting an option from a drop down list in a combo box (cmbFieldList) - how do I go about it??

    Thanks for info.

    Mazzer

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Updating Forms from Control (2003)

    What do you mean by "box"? A text box, or something else?
    If it is a text box, do you want to set its text to the item that has been selected in the combo box? Or something else?
    Please try to be as specific as possible.

  3. #3
    New Lounger
    Join Date
    Jul 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Updating Forms from Control (2003)

    Sorry, its actually a subform - what I am trying to do is update the value of FieldName in the FrmFieldsSub, based on a control on the active Switchboard, which is CmbFieldList. This list is linked to FieldName in the underlying table of FrmFieldsSub. Is that more clear???

    Mazzer

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Updating Forms from Control (2003)

    Something like this?

    Private Sub CmbFieldList_AfterUpdate()
    Me.FrmFieldsSub!FieldName = Me.CmbFieldList
    End Sub

    Here, FrmFieldsSub should be the name of the subform as a control on the main form, which is not necessarily the same as the name of the subform in the database window. To see (or set) the name of the subform as a control, open the main form in design view and click once on the subform. The name is displayed in the Other tab of the Properties window.

  5. #5
    New Lounger
    Join Date
    Jul 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Updating Forms from Control (2003)

    Thanks - right, I see how I'm not making myself clear. That does exactly what I said, ie. updates theFieldName box, however, what I really want it to do is to show in frmFieldsSub all records with the underlying value in FieldName, which is the same as is selected in CmbFieldList.... Sorry if I'm not using the lingo correctly - please bear with me.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Updating Forms from Control (2003)

    OK, you should remove the code I posted again.

    Open the main form in design view.
    Click once on the subform.
    Activate the Data tab of the Properties window.
    Set the Link Master Fields property to CmbFieldList and the Link Child Fields property to FieldName.

    See if it works that way. If the subform isn't updated correctly, try the following code in the After Update event of the combo box:

    Private Sub CmbFieldList_AfterUpdate()
    Me.FrmFieldsSub.Requery
    End Sub

    with the same remark about the subform name as before.

Posting Permissions

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