Combo Box default value

R

Rockn

I am trying to set a default value for a combo box that is a static list
with three items in it. Everything I have found googling has related to
setting the default value in the controls properties using this format:

=[controlname].ItemData(indexnumber)

Using this suggestion hasn't worked so far and I am sure it is a simple
solution.

Thanks.
 
O

Ofer Cohen

It is a Report question isn't it?

If so, then in the combo ControlSource write

=Nz([FieldName],1)

In this examle 1 will be the default - this function will change Null to 1

=============
If I'm in the wrong direction, please explain what do you mean by default
 
R

Rockn

Sorry, it is on a form. I want the default value of the combo box on the
form to be the first item in the list.

Thanks

Ofer Cohen said:
It is a Report question isn't it?

If so, then in the combo ControlSource write

=Nz([FieldName],1)

In this examle 1 will be the default - this function will change Null to 1

=============
If I'm in the wrong direction, please explain what do you mean by default

--
Good Luck
BS"D


Rockn said:
I am trying to set a default value for a combo box that is a static list
with three items in it. Everything I have found googling has related to
setting the default value in the controls properties using this format:

=[controlname].ItemData(indexnumber)

Using this suggestion hasn't worked so far and I am sure it is a simple
solution.

Thanks.
 
R

Rockn

I figured it out.
Using the forms onLoad event

Dim strVar as Long
If IsNull(Me.ControlName) Then
strVar = ControlName.ItemData(0)
End If

Rockn said:
Sorry, it is on a form. I want the default value of the combo box on the
form to be the first item in the list.

Thanks

Ofer Cohen said:
It is a Report question isn't it?

If so, then in the combo ControlSource write

=Nz([FieldName],1)

In this examle 1 will be the default - this function will change Null to
1

=============
If I'm in the wrong direction, please explain what do you mean by default

--
Good Luck
BS"D


Rockn said:
I am trying to set a default value for a combo box that is a static
list
with three items in it. Everything I have found googling has related to
setting the default value in the controls properties using this format:

=[controlname].ItemData(indexnumber)

Using this suggestion hasn't worked so far and I am sure it is a simple
solution.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top