Creating a combo box Programmatically on a table 
Author Message
 Creating a combo box Programmatically on a table

I'm having no luck trying to create a combo box programmatically on a
back-end table.

the property "DisplayControl" appears to be available ONLY in table Design
view.

The combo box I'd like to create contains two fields (the first being the
value the control is bound to, and the second, of course, is what's shown to
the user) :

1;"Employee";2;"Support Staff";3;"Sub Contract"

I'd like to do this so that when I update the client's existing version, I
don't have to do it manually.  -That presents another step that can be
easily forgotten!

Any ideas would be appreaciated!!!



Tue, 02 Oct 2001 03:00:00 GMT  
 Creating a combo box Programmatically on a table
You don't need display control at all.  Try this instead:

Public Sub CreateComboBoxcontrol(frmname As String, ctlname As String)
Dim combo As ComboBox

DoCmd.OpenForm frmname, acDesign, , , , acHidden

Set combo = CreateControl(frmname, acComboBox, acDetail, , , 567, 567, 567, 567)

With combo
        .Name = ctlname
        .RowSourceType = "Value list"
        .RowSource = "1;'employee';2;'fun';3;'whynot'"
        .ControlSource = "Your field name here"
End With
DoCmd.RunCommand acCmdSave
DoCmd.Close acForm, "frmnav"
End Sub

you'll have to come up with the proper dimensions for the combo box (that's all
of those 567's up there).

Quote:

> I'm having no luck trying to create a combo box programmatically on a
> back-end table.

> the property "DisplayControl" appears to be available ONLY in table Design
> view.

> The combo box I'd like to create contains two fields (the first being the
> value the control is bound to, and the second, of course, is what's shown to
> the user) :

> 1;"Employee";2;"Support Staff";3;"Sub Contract"

> I'd like to do this so that when I update the client's existing version, I
> don't have to do it manually.  -That presents another step that can be
> easily forgotten!

> Any ideas would be appreaciated!!!

--
-----------------------------------
Matthew Miller
Ready Net Go, Inc.



Tue, 02 Oct 2001 03:00:00 GMT  
 Creating a combo box Programmatically on a table

This is a property that Access creates. It is not built into the DAO
object model. Therefore, to get to it you need to use the properties
collection of the field:
MyField.Properties("DisplayControl")

The value for a textbox (the default) is 109. The value for a combo
box is 111.

 -- Andy

Quote:

>I'm having no luck trying to create a combo box programmatically on a
>back-end table.

>the property "DisplayControl" appears to be available ONLY in table Design
>view.

>The combo box I'd like to create contains two fields (the first being the
>value the control is bound to, and the second, of course, is what's shown to
>the user) :

>1;"Employee";2;"Support Staff";3;"Sub Contract"

>I'd like to do this so that when I update the client's existing version, I
>don't have to do it manually.  -That presents another step that can be
>easily forgotten!

>Any ideas would be appreaciated!!!



Wed, 03 Oct 2001 03:00:00 GMT  
 Creating a combo box Programmatically on a table
You don't need display control at all.  Try this instead:

Public Sub CreateComboBoxcontrol(frmname As String, ctlname As String)
Dim combo As ComboBox

DoCmd.OpenForm frmname, acDesign, , , , acHidden

Set combo = CreateControl(frmname, acComboBox, acDetail, , , 567, 567, 567, 567)

With combo
        .Name = ctlname
        .RowSourceType = "Value list"
        .RowSource = "1;'employee';2;'fun';3;'whynot'"
        .ControlSource = "Your field name here"
End With
DoCmd.RunCommand acCmdSave
DoCmd.Close acForm, "frmnav"
End Sub

you'll have to come up with the proper dimensions for the combo box (that's all
of those 567's up there).

Quote:

> I'm having no luck trying to create a combo box programmatically on a
> back-end table.

> the property "DisplayControl" appears to be available ONLY in table Design
> view.

> The combo box I'd like to create contains two fields (the first being the
> value the control is bound to, and the second, of course, is what's shown to
> the user) :

> 1;"Employee";2;"Support Staff";3;"Sub Contract"

> I'd like to do this so that when I update the client's existing version, I
> don't have to do it manually.  -That presents another step that can be
> easily forgotten!

> Any ideas would be appreaciated!!!

--
-----------------------------------
Matthew Miller
Ready Net Go, Inc.



Mon, 22 Oct 2001 03:00:00 GMT  
 Creating a combo box Programmatically on a table
I'm having no luck trying to create a combo box programmatically on a
back-end table.

the property "DisplayControl" appears to be available ONLY in table Design
view.

The combo box I'd like to create contains two fields (the first being the
value the control is bound to, and the second, of course, is what's shown to
the user) :

1;"Employee";2;"Support Staff";3;"Sub Contract"

I'd like to do this so that when I update the client's existing version, I
don't have to do it manually.  -That presents another step that can be
easily forgotten!

Any ideas would be appreaciated!!!



Mon, 22 Oct 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Drop-Down Programmatically-Combo Box

2. Newbie: set the selected item in a combo box programmatically

3. Created Form in Word - Irregular movement of combo boxes, text boxes on scrolling

4. how to programmatically create linked table w/o access

5. Creating and deleting referential table links programmatically

6. How do I programmatically create a linked FoxPro table

7. Creating, modifying, deleting tables programmatically.

8. Programmatically transfer DecimalPlaces property from table field to form text box

9. Creating A Table Programmatically

10. Creating text boxes (or other controls) programmatically.

11. enter data in a combo box based on value from another combo box

12. Limit subform combo box by selection in parent combo box

 

 
Powered by phpBB® Forum Software