default value of combo box?

  • Thread starter Thread starter JethroUK©
  • Start date Start date
J

JethroUK©

How might i express the default value of a combobox (start_date) as being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
Regardless of what the data type is, the default value property is a string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)
 
it doesn't seem to like that - thanks anyhow - the fact that default value
has an expression builder suggests it will accept an expression - i've even
tried the expression builder and whilst it shows combo box object, it
doesn't show 'Itemdata' in the list of properties (virtually everything but)


Douglas J. Steele said:
Regardless of what the data type is, the default value property is a string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
How might i express the default value of a combobox (start_date) as being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
Really? It worked fine for me when I tested before posting.

What problem are you having?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
it doesn't seem to like that - thanks anyhow - the fact that default value
has an expression builder suggests it will accept an expression - i've
even
tried the expression builder and whilst it shows combo box object, it
doesn't show 'Itemdata' in the list of properties (virtually everything
but)


Douglas J. Steele said:
Regardless of what the data type is, the default value property is a string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
How might i express the default value of a combobox (start_date) as being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
my fault - i'd mis-typed it so got #Error - sorry :o~

but it works now:

Start_Date.DefaultValue = "=[Start Date].[itemdata](0)"

:o)

which is char 34? it seems to work without it


Douglas J. Steele said:
Really? It worked fine for me when I tested before posting.

What problem are you having?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
it doesn't seem to like that - thanks anyhow - the fact that default value
has an expression builder suggests it will accept an expression - i've
even
tried the expression builder and whilst it shows combo box object, it
doesn't show 'Itemdata' in the list of properties (virtually everything
but)


Douglas J. Steele said:
Regardless of what the data type is, the default value property is a string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



How might i express the default value of a combobox (start_date) as being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
Chr$(34) is a double quote.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
my fault - i'd mis-typed it so got #Error - sorry :o~

but it works now:

Start_Date.DefaultValue = "=[Start Date].[itemdata](0)"

:o)

which is char 34? it seems to work without it


Douglas J. Steele said:
Really? It worked fine for me when I tested before posting.

What problem are you having?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
it doesn't seem to like that - thanks anyhow - the fact that default value
has an expression builder suggests it will accept an expression - i've
even
tried the expression builder and whilst it shows combo box object, it
doesn't show 'Itemdata' in the list of properties (virtually everything
but)


message
Regardless of what the data type is, the default value property is a
string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



How might i express the default value of a combobox (start_date) as
being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
ah! thanx

Douglas J. Steele said:
Chr$(34) is a double quote.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JethroUK© said:
my fault - i'd mis-typed it so got #Error - sorry :o~

but it works now:

Start_Date.DefaultValue = "=[Start Date].[itemdata](0)"

:o)

which is char 34? it seems to work without it


Douglas J. Steele said:
Really? It worked fine for me when I tested before posting.

What problem are you having?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



it doesn't seem to like that - thanks anyhow - the fact that default value
has an expression builder suggests it will accept an expression - i've
even
tried the expression builder and whilst it shows combo box object, it
doesn't show 'Itemdata' in the list of properties (virtually everything
but)


message
Regardless of what the data type is, the default value property is a
string,
so it must have quotes around it.

Try putting code similar to below in the form's Load event:

Me.MyCombo.DefaultValue = Chr$(34) & Me.MyCombo.ItemDate(0) & Chr$(34)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



How might i express the default value of a combobox (start_date) as
being
the first item in the existing list?

default value =[start_date].[Itemdata(0)]
 
Back
Top