Unable to set Text property of a Combo Box

Ask a Question related to Microsoft Access, Design and Development.

  1. #1

    Default Unable to set Text property of a Combo Box

    Hi,

    I'm trying to set Text property of a Combo Box and getting
    an error message as below

    "Run-tim error '2135'. This property is read-only and
    can't be set."

    Does anyone know that how I can set this property?
    I have already set the Enabled & Visible propery be True
    for the Combo Box, and have the Combo Box SetFocus before
    I tried to set Text property.

    Thanks in advance.

    May
    May Guest

  2. Similar Questions and Discussions

    1. Unable to set the XValues property of the Series class
      Hi All, I have tried umpteen ways of setting the XValues in an Excel Spreadsheet from Perl 5.8.7 using Win32::OLE, and I cannot get anything to...
    2. Combo Box Prompt Property
      Hi , In the Flex API, I found the following information regarding the prompt property of a combo box "The prompts for the ComboBox control....
    3. Unable to access a control property - Stack Overflow..
      I've made a user control (ascx and ascx.cs) that works fine if I use a session var to pass it value. However, I'd much prefer to set a property...
    4. Unable to edit button text in property manager
      I have created a button and cloned 3 other instances on a nav bar (actually, I'm just doing the tutorial). Anyway, when I select the instance to...
    5. Unable to bring up folders' property page and thus create shares
      The WinXP Pro OS on my labtop is some how no longer be able to bring up the folders' properties pages. I initially noticed this while trying to...
  3. #2

    Default Re: Unable to set Text property of a Combo Box

    Hi May,

    If you have a VB background then you need to know that the Text property in
    Access is a bit different. The Value property is probably what you are
    really trying to set and you don't even need to specify it explicitly since
    it is the default property of the control. For example, either will work:

    me.cboStuff=3
    me.cboStuff.Value=3

    The text Property in Access contains whatever has been typed into the
    control, but not yet saved to the Value property of the control. This
    property is only available when the control has the focus - which is
    probably why you are getting the error.

    Hope this helps,

    --
    Sandra Daigle
    [Microsoft Access MVP]
    For the benefit of others please post all replies to this newsgroup.

    May wrote:
    > Hi,
    >
    > I'm trying to set Text property of a Combo Box and getting
    > an error message as below
    >
    > "Run-tim error '2135'. This property is read-only and
    > can't be set."
    >
    > Does anyone know that how I can set this property?
    > I have already set the Enabled & Visible propery be True
    > for the Combo Box, and have the Combo Box SetFocus before
    > I tried to set Text property.
    >
    > Thanks in advance.
    >
    > May
    Sandra Daigle Guest

  4. #3

    Default Re: Unable to set Text property of a Combo Box

    Thanks Sandra.

    I've tried to set the comboBox without specifiying the
    properties, it doesn't allow me. I get the error message
    as "Run-time error'-2147352567 (80020009)' You can't
    assign a value to this object."

    The RowSourceType of my comboBox is "Table/Query" and I
    put the actual query in thh RowSource property. I'm not
    sure if this is the reason that I can't assign a value to
    the comboBox. In fact, the value that I'm assigning is
    one of the item from the dropdown list which I get from
    other table.

    Again, before I assign the value to my combobox, I have
    setFocus already.

    Can you please give me more idea on what else I can do?

    Thanks.
    >-----Original Message-----
    >Hi May,
    >
    >If you have a VB background then you need to know that
    the Text property in
    >Access is a bit different. The Value property is probably
    what you are
    >really trying to set and you don't even need to specify
    it explicitly since
    >it is the default property of the control. For example,
    either will work:
    >
    >me.cboStuff=3
    >me.cboStuff.Value=3
    >
    >The text Property in Access contains whatever has been
    typed into the
    >control, but not yet saved to the Value property of the
    control. This
    >property is only available when the control has the
    focus - which is
    >probably why you are getting the error.
    >
    >Hope this helps,
    >
    >--
    >Sandra Daigle
    >[Microsoft Access MVP]
    >For the benefit of others please post all replies to this
    newsgroup.
    >
    >May wrote:
    >> Hi,
    >>
    >> I'm trying to set Text property of a Combo Box and
    getting
    >> an error message as below
    >>
    >> "Run-tim error '2135'. This property is read-only and
    >> can't be set."
    >>
    >> Does anyone know that how I can set this property?
    >> I have already set the Enabled & Visible propery be True
    >> for the Combo Box, and have the Combo Box SetFocus
    before
    >> I tried to set Text property.
    >>
    >> Thanks in advance.
    >>
    >> May
    >
    >.
    >
    May Guest

  5. #4

    Default Re: Unable to set Text property of a Combo Box

    Hi May,

    Just to be clear, you don't need to setfocus to the control in order to set
    its value. That doesn't solve your problem but it is useful to know.

    Post the code you are using to assign the value to the combo. Also be sure
    to include the name of the combo, the field to which it is bound and any
    other details that might be relevant to help explain the exact situation.

    --
    Sandra Daigle
    [Microsoft Access MVP]
    For the benefit of others please post all replies to this newsgroup.

    May wrote:
    > Thanks Sandra.
    >
    > I've tried to set the comboBox without specifiying the
    > properties, it doesn't allow me. I get the error message
    > as "Run-time error'-2147352567 (80020009)' You can't
    > assign a value to this object."
    >
    > The RowSourceType of my comboBox is "Table/Query" and I
    > put the actual query in thh RowSource property. I'm not
    > sure if this is the reason that I can't assign a value to
    > the comboBox. In fact, the value that I'm assigning is
    > one of the item from the dropdown list which I get from
    > other table.
    >
    > Again, before I assign the value to my combobox, I have
    > setFocus already.
    >
    > Can you please give me more idea on what else I can do?
    >
    > Thanks.
    Sandra Daigle Guest

  6. #5

    Default Re: Unable to set Text property of a Combo Box

    Thanks Sandra for getting back to me.

    Below is the code to set property of the ComboBox and
    assign value to the ComboBox.

    FACILITY_COMBO.Enabled = True
    FACILITY_COMBO.Visible = True
    FACILITY_COMBO.SetFocus
    FACILITY_COMBO = FACILITY_NUMBER

    I'm getting the "Run-time error'-2147352567 (80020009)'"
    in the assignment statement. Before the debugger steps
    into the assignment statement, the
    FACILITY_NUMBER.value="2099".

    FACILITY_NUMBER is a field on the same form which is from
    recordset of the form.

    In the RowSourceType property of FACILITY_COMBO, I
    put "Table/Query"
    In the RowSource property of FACILITY_COMBO, I put "SELECT
    LOCATIONTABLE.location, LOCATIONTABLE.locationname
    FROM LOCATIONTABLE;"

    In the ControlSource property of FACILITY_COMBO, I
    put "=LOCATIONTABLE!location"

    I hope I've given enough info for you to understand.
    Thanks for your help.

    May

    >-----Original Message-----
    >Hi May,
    >
    >Just to be clear, you don't need to setfocus to the
    control in order to set
    >its value. That doesn't solve your problem but it is
    useful to know.
    >
    >Post the code you are using to assign the value to the
    combo. Also be sure
    >to include the name of the combo, the field to which it
    is bound and any
    >other details that might be relevant to help explain the
    exact situation.
    >
    >--
    >Sandra Daigle
    >[Microsoft Access MVP]
    >For the benefit of others please post all replies to this
    newsgroup.
    >
    >May wrote:
    >> Thanks Sandra.
    >>
    >> I've tried to set the comboBox without specifiying the
    >> properties, it doesn't allow me. I get the error
    message
    >> as "Run-time error'-2147352567 (80020009)' You can't
    >> assign a value to this object."
    >>
    >> The RowSourceType of my comboBox is "Table/Query" and I
    >> put the actual query in thh RowSource property. I'm not
    >> sure if this is the reason that I can't assign a value
    to
    >> the comboBox. In fact, the value that I'm assigning is
    >> one of the item from the dropdown list which I get from
    >> other table.
    >>
    >> Again, before I assign the value to my combobox, I have
    >> setFocus already.
    >>
    >> Can you please give me more idea on what else I can do?
    >>
    >> Thanks.
    >
    >.
    >
    May Guest

  7. #6

    Default Re: Unable to set Text property of a Combo Box

    Hi May,

    Now I'm confused. I really don't understand what it is that you are trying
    to do (this might have something to do with it being Friday afternoon :-)).
    What recordset are you talking about?

    If you put an expression in the controlsource of a control, you can not
    assign a value it later. You can either leave the control unbound
    (controlsource is empty) or bind it to a field, in which case the
    ControlSource would have the field name with no equals sign (=) in front of
    it.

    --
    Sandra Daigle
    [Microsoft Access MVP]
    For the benefit of others please post all replies to this newsgroup.


    May wrote:
    > Actually, what I want to do is to be able to modify the
    > FACITLITY_NUMBER in the recordset, the FACILITY_NUMBER is
    > actually from a lookup table (that's why I want to list
    > them in the Combo LOCATIONTABLE)
    >
    > That's why I a FACILITY_NUMBER field which is storing the
    > facility_number from the record set, and copy the value
    > manually (when form is loaded) to a Combo, so that user
    > can make changes from the dropdown list. After the Combo
    > is changed, I will copy the value back to FACILITY_NUMBER
    > field so that the recordset can be updated.
    >
    > I believe this is not unusual, but I don't know what I
    > should do to make it happen.
    >
    > Thanks.
    >
    > May
    >> -----Original Message-----
    >>
    >> Hi May,
    >>
    >> If you have "=LOCATIONTABLE!location" in the Controlsource of the
    >> Combo it is a calculated control and you can not assign a new value
    >> to it in code. Is Location a field in the Recordsource query of the
    >> form? If so, shouldn't the combo just be bound directly to that
    >> field?
    >>
    >> --
    >> Sandra Daigle
    >> [Microsoft Access MVP]
    >> For the benefit of others please post all replies to this newsgroup.
    >>
    >>
    >> May wrote:
    >>> Thanks Sandra for getting back to me.
    >>>
    >>> Below is the code to set property of the ComboBox and
    >>> assign value to the ComboBox.
    >>>
    >>> FACILITY_COMBO.Enabled = True
    >>> FACILITY_COMBO.Visible = True
    >>> FACILITY_COMBO.SetFocus
    >>> FACILITY_COMBO = FACILITY_NUMBER
    >>>
    >>> I'm getting the "Run-time error'-2147352567 (80020009)'"
    >>> in the assignment statement. Before the debugger steps
    >>> into the assignment statement, the
    >>> FACILITY_NUMBER.value="2099".
    >>>
    >>> FACILITY_NUMBER is a field on the same form which is from
    >>> recordset of the form.
    >>>
    >>> In the RowSourceType property of FACILITY_COMBO, I
    >>> put "Table/Query"
    >>> In the RowSource property of FACILITY_COMBO, I
    > put "SELECT
    >>> LOCATIONTABLE.location, LOCATIONTABLE.locationname
    >>> FROM LOCATIONTABLE;"
    >>>
    >>> In the ControlSource property of FACILITY_COMBO, I
    >>> put "=LOCATIONTABLE!location"
    >>>
    >>> I hope I've given enough info for you to understand.
    >>> Thanks for your help.
    >>>
    >>> May
    >>>
    >>>
    >>
    >> .
    Sandra Daigle Guest

  8. #7

    Default Re: Unable to set Text property of a Combo Box

    Hi Sandra,
    Sorry, it must be me to confuse you!!!
    Let me restate my situation here.

    I have a table named MARKETTABLE, FACILITY_NUMBER is one
    of the fields in MARKETTABLE record. I have another
    lookup table named LOCATIONTABLE, LOCATIONID is one of the
    fields in LOCATIONTABLE.
    MARKETTABLE.FACILITY_NUMBER is referring to the lookup
    table LOCATIONTABLE.LOCATIONID.
    I have a query to select all records in MARKETTABLE,
    FACILITY_NUMBER is one of the selected fields.
    I want the user to be able to change
    MARKETTABLE.FACILITY_NUMBER (which they can choose from
    the LOCATIONTABLE.LOCATIONID).
    This is why I have a Combo for LOCATIONTABLE.LOCATIONID,
    and I also try to assign the MARKETTABLE.FACILITY_NUMBER
    to the Combo (so that user knows what is the original
    value of the MARKETTABLE.FACILITY_NUMBER, and what are the
    choices they have to change to).

    That's why the Combo must be bounded by

    RowSourceType="Table/Query"
    RowSource="SELECT LOCATIONTABLE.location,
    LOCATIONTABLE.locationname FROM LOCATIONTABLE;"
    ControlSource="=LOCATIONTABLE!location"

    I hope I make it clearer this time.

    Please let me know if you have any idea on my issue.
    >-----Original Message-----
    >Hi May,
    >
    >Now I'm confused. I really don't understand what it is
    that you are trying
    >to do (this might have something to do with it being
    Friday afternoon :-)).
    >What recordset are you talking about?
    >
    >If you put an expression in the controlsource of a
    control, you can not
    >assign a value it later. You can either leave the control
    unbound
    >(controlsource is empty) or bind it to a field, in which
    case the
    >ControlSource would have the field name with no equals
    sign (=) in front of
    >it.
    >
    >--
    >Sandra Daigle
    >[Microsoft Access MVP]
    >For the benefit of others please post all replies to this
    newsgroup.
    >
    >
    >May wrote:
    >> Actually, what I want to do is to be able to modify the
    >> FACITLITY_NUMBER in the recordset, the FACILITY_NUMBER
    is
    >> actually from a lookup table (that's why I want to list
    >> them in the Combo LOCATIONTABLE)
    >>
    >> That's why I a FACILITY_NUMBER field which is storing
    the
    >> facility_number from the record set, and copy the value
    >> manually (when form is loaded) to a Combo, so that user
    >> can make changes from the dropdown list. After the
    Combo
    >> is changed, I will copy the value back to
    FACILITY_NUMBER
    >> field so that the recordset can be updated.
    >>
    >> I believe this is not unusual, but I don't know what I
    >> should do to make it happen.
    >>
    >> Thanks.
    >>
    >> May
    >>> -----Original Message-----
    >>>
    >>> Hi May,
    >>>
    >>> If you have "=LOCATIONTABLE!location" in the
    Controlsource of the
    >>> Combo it is a calculated control and you can not
    assign a new value
    >>> to it in code. Is Location a field in the Recordsource
    query of the
    >>> form? If so, shouldn't the combo just be bound
    directly to that
    >>> field?
    >>>
    >>> --
    >>> Sandra Daigle
    >>> [Microsoft Access MVP]
    >>> For the benefit of others please post all replies to
    this newsgroup.
    >>>
    >>>
    >>> May wrote:
    >>>> Thanks Sandra for getting back to me.
    >>>>
    >>>> Below is the code to set property of the ComboBox and
    >>>> assign value to the ComboBox.
    >>>>
    >>>> FACILITY_COMBO.Enabled = True
    >>>> FACILITY_COMBO.Visible = True
    >>>> FACILITY_COMBO.SetFocus
    >>>> FACILITY_COMBO = FACILITY_NUMBER
    >>>>
    >>>> I'm getting the "Run-time error'-2147352567
    (80020009)'"
    >>>> in the assignment statement. Before the debugger
    steps
    >>>> into the assignment statement, the
    >>>> FACILITY_NUMBER.value="2099".
    >>>>
    >>>> FACILITY_NUMBER is a field on the same form which is
    from
    >>>> recordset of the form.
    >>>>
    >>>> In the RowSourceType property of FACILITY_COMBO, I
    >>>> put "Table/Query"
    >>>> In the RowSource property of FACILITY_COMBO, I
    >> put "SELECT
    >>>> LOCATIONTABLE.location, LOCATIONTABLE.locationname
    >>>> FROM LOCATIONTABLE;"
    >>>>
    >>>> In the ControlSource property of FACILITY_COMBO, I
    >>>> put "=LOCATIONTABLE!location"
    >>>>
    >>>> I hope I've given enough info for you to understand.
    >>>> Thanks for your help.
    >>>>
    >>>> May
    >>>>
    >>>>
    >>>
    >>> .
    >
    >.
    >
    May Guest

  9. #8

    Default Re: Unable to set Text property of a Combo Box

    Hi May,

    I think you simply need to set the Controlsource of the combo to
    Markettable.Facility_number (select it from the dropdown list in the
    ControlSource property). That's probably all you need to do.

    --
    Sandra Daigle
    [Microsoft Access MVP]
    For the benefit of others please post all replies to this newsgroup.


    May wrote:
    > Hi Sandra,
    > Sorry, it must be me to confuse you!!!
    > Let me restate my situation here.
    >
    > I have a table named MARKETTABLE, FACILITY_NUMBER is one
    > of the fields in MARKETTABLE record. I have another
    > lookup table named LOCATIONTABLE, LOCATIONID is one of the
    > fields in LOCATIONTABLE.
    > MARKETTABLE.FACILITY_NUMBER is referring to the lookup
    > table LOCATIONTABLE.LOCATIONID.
    > I have a query to select all records in MARKETTABLE,
    > FACILITY_NUMBER is one of the selected fields.
    > I want the user to be able to change
    > MARKETTABLE.FACILITY_NUMBER (which they can choose from
    > the LOCATIONTABLE.LOCATIONID).
    > This is why I have a Combo for LOCATIONTABLE.LOCATIONID,
    > and I also try to assign the MARKETTABLE.FACILITY_NUMBER
    > to the Combo (so that user knows what is the original
    > value of the MARKETTABLE.FACILITY_NUMBER, and what are the
    > choices they have to change to).
    >
    > That's why the Combo must be bounded by
    >
    > RowSourceType="Table/Query"
    > RowSource="SELECT LOCATIONTABLE.location,
    > LOCATIONTABLE.locationname FROM LOCATIONTABLE;"
    > ControlSource="=LOCATIONTABLE!location"
    >
    > I hope I make it clearer this time.
    >
    > Please let me know if you have any idea on my issue.
    >
    >> -----Original Message-----
    >> Hi May,
    >>
    >> Now I'm confused. I really don't understand what it is that you are
    >> trying to do (this might have something to do with it being Friday
    >> afternoon :-)). What recordset are you talking about?
    >>
    >> If you put an expression in the controlsource of a control, you can
    >> not assign a value it later. You can either leave the control unbound
    >> (controlsource is empty) or bind it to a field, in which case the
    >> ControlSource would have the field name with no equals sign (=) in
    >> front of it.
    >>
    >> --
    >> Sandra Daigle
    >> [Microsoft Access MVP]
    >> For the benefit of others please post all replies to this newsgroup.
    >>
    >>
    >> May wrote:
    >>> Actually, what I want to do is to be able to modify the
    >>> FACITLITY_NUMBER in the recordset, the FACILITY_NUMBER is
    >>> actually from a lookup table (that's why I want to list
    >>> them in the Combo LOCATIONTABLE)
    >>>
    >>> That's why I a FACILITY_NUMBER field which is storing the
    >>> facility_number from the record set, and copy the value
    >>> manually (when form is loaded) to a Combo, so that user
    >>> can make changes from the dropdown list. After the Combo
    >>> is changed, I will copy the value back to FACILITY_NUMBER
    >>> field so that the recordset can be updated.
    >>>
    >>> I believe this is not unusual, but I don't know what I
    >>> should do to make it happen.
    >>>
    >>> Thanks.
    >>>
    >>> May
    >>>> -----Original Message-----
    >>>>
    >>>> Hi May,
    >>>>
    >>>> If you have "=LOCATIONTABLE!location" in the Controlsource of the
    >>>> Combo it is a calculated control and you can not assign a new value
    >>>> to it in code. Is Location a field in the Recordsource query of the
    >>>> form? If so, shouldn't the combo just be bound directly to that
    >>>> field?
    >>>>
    >>>> --
    >>>> Sandra Daigle
    >>>> [Microsoft Access MVP]
    >>>> For the benefit of others please post all replies to this
    >>>> newsgroup.
    >>>>
    >>>>
    >>>> May wrote:
    >>>>> Thanks Sandra for getting back to me.
    >>>>>
    >>>>> Below is the code to set property of the ComboBox and
    >>>>> assign value to the ComboBox.
    >>>>>
    >>>>> FACILITY_COMBO.Enabled = True
    >>>>> FACILITY_COMBO.Visible = True
    >>>>> FACILITY_COMBO.SetFocus
    >>>>> FACILITY_COMBO = FACILITY_NUMBER
    >>>>>
    >>>>> I'm getting the "Run-time error'-2147352567 (80020009)'"
    >>>>> in the assignment statement. Before the debugger steps
    >>>>> into the assignment statement, the
    >>>>> FACILITY_NUMBER.value="2099".
    >>>>>
    >>>>> FACILITY_NUMBER is a field on the same form which is from
    >>>>> recordset of the form.
    >>>>>
    >>>>> In the RowSourceType property of FACILITY_COMBO, I
    >>>>> put "Table/Query"
    >>>>> In the RowSource property of FACILITY_COMBO, I
    >>> put "SELECT
    >>>>> LOCATIONTABLE.location, LOCATIONTABLE.locationname
    >>>>> FROM LOCATIONTABLE;"
    >>>>>
    >>>>> In the ControlSource property of FACILITY_COMBO, I
    >>>>> put "=LOCATIONTABLE!location"
    >>>>>
    >>>>> I hope I've given enough info for you to understand.
    >>>>> Thanks for your help.
    >>>>>
    >>>>> May
    >>>>>
    >>>>>
    >>>>
    >>>> .
    >>
    >> .
    Sandra Daigle Guest

  10. #9

    Default Re: Unable to set Text property of a Combo Box

    Thanks Sandra.
    I tried, the Combo is now showing the
    MARKETTABLE.FACILITY_NUMBER. However, I got another error
    now when I try to select other value from the dropdown
    list, which is "Control can't be edited; it's bound to the
    expression 'FACILITY_NUMBER'". This message shows on the
    Status Bar.
    I have tried to change the ControlSource of the Combo in
    the Click event, but it doesn't make any difference.
    Do you have any idea how this can be solved?

    Thanks.

    May
    >-----Original Message-----
    >Hi May,
    >
    >I think you simply need to set the Controlsource of the
    combo to
    >Markettable.Facility_number (select it from the dropdown
    list in the
    >ControlSource property). That's probably all you need to
    do.
    >
    >--
    >Sandra Daigle
    >[Microsoft Access MVP]
    >For the benefit of others please post all replies to this
    newsgroup.
    >
    >
    >May wrote:
    >> Hi Sandra,
    >> Sorry, it must be me to confuse you!!!
    >> Let me restate my situation here.
    >>
    >> I have a table named MARKETTABLE, FACILITY_NUMBER is one
    >> of the fields in MARKETTABLE record. I have another
    >> lookup table named LOCATIONTABLE, LOCATIONID is one of
    the
    >> fields in LOCATIONTABLE.
    >> MARKETTABLE.FACILITY_NUMBER is referring to the lookup
    >> table LOCATIONTABLE.LOCATIONID.
    >> I have a query to select all records in MARKETTABLE,
    >> FACILITY_NUMBER is one of the selected fields.
    >> I want the user to be able to change
    >> MARKETTABLE.FACILITY_NUMBER (which they can choose from
    >> the LOCATIONTABLE.LOCATIONID).
    >> This is why I have a Combo for LOCATIONTABLE.LOCATIONID,
    >> and I also try to assign the MARKETTABLE.FACILITY_NUMBER
    >> to the Combo (so that user knows what is the original
    >> value of the MARKETTABLE.FACILITY_NUMBER, and what are
    the
    >> choices they have to change to).
    >>
    >> That's why the Combo must be bounded by
    >>
    >> RowSourceType="Table/Query"
    >> RowSource="SELECT LOCATIONTABLE.location,
    >> LOCATIONTABLE.locationname FROM LOCATIONTABLE;"
    >> ControlSource="=LOCATIONTABLE!location"
    >>
    >> I hope I make it clearer this time.
    >>
    >> Please let me know if you have any idea on my issue.
    >>
    >>> -----Original Message-----
    >>> Hi May,
    >>>
    >>> Now I'm confused. I really don't understand what it is
    that you are
    >>> trying to do (this might have something to do with it
    being Friday
    >>> afternoon :-)). What recordset are you talking about?
    >>>
    >>> If you put an expression in the controlsource of a
    control, you can
    >>> not assign a value it later. You can either leave the
    control unbound
    >>> (controlsource is empty) or bind it to a field, in
    which case the
    >>> ControlSource would have the field name with no equals
    sign (=) in
    >>> front of it.
    >>>
    >>> --
    >>> Sandra Daigle
    >>> [Microsoft Access MVP]
    >>> For the benefit of others please post all replies to
    this newsgroup.
    >>>
    >>>
    >>> May wrote:
    >>>> Actually, what I want to do is to be able to modify
    the
    >>>> FACITLITY_NUMBER in the recordset, the
    FACILITY_NUMBER is
    >>>> actually from a lookup table (that's why I want to
    list
    >>>> them in the Combo LOCATIONTABLE)
    >>>>
    >>>> That's why I a FACILITY_NUMBER field which is storing
    the
    >>>> facility_number from the record set, and copy the
    value
    >>>> manually (when form is loaded) to a Combo, so that
    user
    >>>> can make changes from the dropdown list. After the
    Combo
    >>>> is changed, I will copy the value back to
    FACILITY_NUMBER
    >>>> field so that the recordset can be updated.
    >>>>
    >>>> I believe this is not unusual, but I don't know what I
    >>>> should do to make it happen.
    >>>>
    >>>> Thanks.
    >>>>
    >>>> May
    >>>>> -----Original Message-----
    >>>>>
    >>>>> Hi May,
    >>>>>
    >>>>> If you have "=LOCATIONTABLE!location" in the
    Controlsource of the
    >>>>> Combo it is a calculated control and you can not
    assign a new value
    >>>>> to it in code. Is Location a field in the
    Recordsource query of the
    >>>>> form? If so, shouldn't the combo just be bound
    directly to that
    >>>>> field?
    >>>>>
    >>>>> --
    >>>>> Sandra Daigle
    >>>>> [Microsoft Access MVP]
    >>>>> For the benefit of others please post all replies to
    this
    >>>>> newsgroup.
    >>>>>
    >>>>>
    >>>>> May wrote:
    >>>>>> Thanks Sandra for getting back to me.
    >>>>>>
    >>>>>> Below is the code to set property of the ComboBox
    and
    >>>>>> assign value to the ComboBox.
    >>>>>>
    >>>>>> FACILITY_COMBO.Enabled = True
    >>>>>> FACILITY_COMBO.Visible = True
    >>>>>> FACILITY_COMBO.SetFocus
    >>>>>> FACILITY_COMBO = FACILITY_NUMBER
    >>>>>>
    >>>>>> I'm getting the "Run-time error'-2147352567
    (80020009)'"
    >>>>>> in the assignment statement. Before the debugger
    steps
    >>>>>> into the assignment statement, the
    >>>>>> FACILITY_NUMBER.value="2099".
    >>>>>>
    >>>>>> FACILITY_NUMBER is a field on the same form which
    is from
    >>>>>> recordset of the form.
    >>>>>>
    >>>>>> In the RowSourceType property of FACILITY_COMBO, I
    >>>>>> put "Table/Query"
    >>>>>> In the RowSource property of FACILITY_COMBO, I
    >>>> put "SELECT
    >>>>>> LOCATIONTABLE.location, LOCATIONTABLE.locationname
    >>>>>> FROM LOCATIONTABLE;"
    >>>>>>
    >>>>>> In the ControlSource property of FACILITY_COMBO, I
    >>>>>> put "=LOCATIONTABLE!location"
    >>>>>>
    >>>>>> I hope I've given enough info for you to understand.
    >>>>>> Thanks for your help.
    >>>>>>
    >>>>>> May
    >>>>>>
    >>>>>>
    >>>>>
    >>>>> .
    >>>
    >>> .
    >
    >.
    >
    May Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139