Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ControlSource (2002)

    I have a pop up form that gets opened from a main form. On the popup form, I'd like to have a read only text box that contains the data in the first column of a listbox on the main form. I put the following in the controlsource property of the text box on the popup form.

    =Forms!frmMtchd.Form!lstMtchd.column(0,Forms!frmMt chd!lstMtchd.ItemsSelected)

    also tried several others


    When the popup form opens, the text box that I want populated says "#NAME?". What am I missing? <img src=/S/confused.gif border=0 alt=confused width=15 height=20> Any help would be appreciated.

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ControlSource (2002)

    Did you try this?
    =Forms!frmMtchd.Form!lstMtchd.column(0)
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ControlSource (2002)

    that didn't generate an error, but it returns a -1. I'm looking for the value. Any ideas?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ControlSource (2002)

    What is the value of the bound column for the selected record? For that matter, has a selection been made in that listbox? And is it a multiselect listbox, which changes the rules? Without more information, it's pretty difficult to give you a useful answer.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ControlSource (2002)

    A record has been selected in the listbox. It is not a multiselect listbox, only one record can be selected at a time. The value for the bound column is 9, I'd like to return the first column in the list box, which is "2660 Medary". The mdb is massive so I can't really post it. Enough info?

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ControlSource (2002)

    What is the rowsource of the listbox? You say the value is 9 but you want to return "2660 Medary". Is this a bound or unbound listbox? You should be able to post the SQL for the rowsource of the listbox. That would help.
    Charlotte

  7. #7
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ControlSource (2002)

    It's an unbound listbox, RowSource Type is Table/Query. I use the list box to select a property on the main form, then open the popup form. The rowsource query is based on another query, "tblPrprtsSbjct.ID AS SbjctID" in the qryMtchdSlctn query below is the bound column in the query used as the rowsource.

    Rowsource query is:
    SELECT qryMtchdSlctn.Strt_Adrs, qryMtchdSlctn.Cty, qryMtchdSlctn.Zip_Code, qryMtchdSlctn.Sale_Bid_By_Dt,
    qryMtchdSlctn.LeadType, qryMtchdSlctn.LeadName, qryMtchdSlctn.SellerName,
    qryMtchdSlctn.tblPrprtsSbjct.ID, qryMtchdSlctn.tblPrprtsAdtr.ID
    FROM qryMtchdSlctn;

    qryMtchdSlctn is:
    SELECT tblPrprtsSbjct.Sale_Bid_By_Dt, tblPrprtsAdtr.Strt_Adrs, tblPrprtsAdtr.Cty, tblPrprtsAdtr.Zip_Code, tblLeadType.LeadType, tblLeadCntct.FstNm & " " & tblLeadCntct.LstNm AS LeadName, tblSellerCntct.FstNm & " " & tblSellerCntct.LstNm AS SellerName, tblPrprtsSbjct.ID, tblPrprtsAdtr.ID, tblPrprtsSbjct.ID AS SbjctID
    FROM tblSellerCntct INNER JOIN (tblPrprtsAdtr INNER JOIN (tblLeadType INNER JOIN (tblLeadCntct INNER JOIN tblPrprtsSbjct ON tblLeadCntct.ID=tblPrprtsSbjct.LeadCntct_ID) ON tblLeadType.ID=tblPrprtsSbjct.LeadType_ID) ON tblPrprtsAdtr.ID=tblPrprtsSbjct.AdtrSmry_ID) ON tblSellerCntct.ID=tblPrprtsSbjct.SellerCntct_ID;

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

    Re: ControlSource (2002)

    Since the list box is unbound, try setting the Bound Column property to 1, and using this as control source for the text box on the popup form:

    =[Forms]![frmMtchd]![lstMtchd]

  9. #9
    2 Star Lounger
    Join Date
    Feb 2003
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ControlSource (2002)

    Thanks Hans, that worked perfectly. I think I may have asked you this before. Do you know of any examples of the syntax used for the controlsource property? I need to use some domain aggregate functions and reference other controls (similiar to this) in some text boxes. I always seem to get hung up on getting the correct syntax.

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

    Re: ControlSource (2002)

    Forms: Refer to Form and Subform properties and controls on the Access Web is a good reference for how to refer to controls on forms and subforms.

    The built-in help for Access VBA has extensive information about the domain aggregate functions:
    - Activate the Visual Basic Editor (Alt+F11)
    - Activate the Immediate window (Ctrl+G)
    - Type DSum and press F1.
    - Click See Also in the help window for info about the other domain aggregate functions.

Posting Permissions

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