Reuset the Default Value

B

bw

When I first click on the CancelFlightButton, the Default Value "Select a
Flight" appears in the ComboBox. After the first click, I am unable to set
the value of the ComboBox to "Select a Flight" again, as the ComboBox is a
numeric field.

How do I reset the value in the ComboBox so it displays "Select a Flight" as
it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value = "Select
a Flight", and it is hidden behind the "CancelFlightButton" Command Button.
The Combo Box has the following code (if ans =vbYes, I do something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set this to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
J

Jeff Boyce

Are you using MS Access? Is this a commercial application or one you've
written?

Are you working in a form? We aren't there, we can't see what you're doing.

I have no idea what code you might have behind your command buttons, or what
controls you have.

It is rare to use a combo box to display a numeric value -- usually, they
STORE a numeric value, but display a text value to make it easier on the
user. Which of the fields "feeding" your combo box is marked as the Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

bw

I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore using MS
Access and working in a form. This is an application that I've written for
personal use.

My original question is poorly presented, so I have presented it again in a
more understandable form.

If the combo box displays a numeric value, how does it display a non-numeric
value for a default value, and once it does, how do I make it display that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if you
wish.


Jeff Boyce said:
Are you using MS Access? Is this a commercial application or one you've
written?

Are you working in a form? We aren't there, we can't see what you're
doing.

I have no idea what code you might have behind your command buttons, or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually, they
STORE a numeric value, but display a text value to make it easier on the
user. Which of the fields "feeding" your combo box is marked as the Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


bw said:
When I first click on the CancelFlightButton, the Default Value "Select a
Flight" appears in the ComboBox. After the first click, I am unable to
set the value of the ComboBox to "Select a Flight" again, as the ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value =
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans =vbYes, I do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set this to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
J

Jeff Boyce

I asked the questions I did because the description didn't provide enough
clues. You might be surprised to learn how often folks post question in
these newsgroups that have nothing whatsoever to do with the title of the
newsgroups.

A combo box has a source (e.g., a query<preferably> or a table) and a number
of fields from that source. Typically, the "bound column" is the first one,
and that one is typically the ID field, usually numeric. To prevent that
field from being seen, its column width is set to zero.

In addition, the combo box's source contains at least one additional field,
usually text and more user-friendly. The column width of this field is set
to some non-zero value.

Since the bound column is numeric, to set the default value property of the
combo box, you'd need to give it a numeric value. Because the combo box
DISPLAYS the text value that corresponds to that numeric value, it appears
you've given the combo box a text value for a default (but you haven't).

Is there a chance that the underlying field in the table is defined as a
Lookup datatype? If so, you've encountered one of the strong reasons not to
use this datatype -- what it shows and what it stores are two different
things...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


bw said:
I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore using MS
Access and working in a form. This is an application that I've written for
personal use.

My original question is poorly presented, so I have presented it again in a
more understandable form.

If the combo box displays a numeric value, how does it display a non-numeric
value for a default value, and once it does, how do I make it display that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if you
wish.


Jeff Boyce said:
Are you using MS Access? Is this a commercial application or one you've
written?

Are you working in a form? We aren't there, we can't see what you're
doing.

I have no idea what code you might have behind your command buttons, or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually, they
STORE a numeric value, but display a text value to make it easier on the
user. Which of the fields "feeding" your combo box is marked as the Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


bw said:
When I first click on the CancelFlightButton, the Default Value "Select a
Flight" appears in the ComboBox. After the first click, I am unable to
set the value of the ComboBox to "Select a Flight" again, as the ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value =
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans =vbYes, I do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set this to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
B

bw

Thanks for the reply, Jeff.
Is there a chance that the underlying field in the table is defined as a
Lookup datatype?
No, the underlying field is defined as a Number Data Type.

I'm sorry to be so dense, but I just don't get what you're saying.
When the FORM OPENS, the combo box displays the default value I have
specified, which is "Select a Flight".
When I have decided (via code) to "restore" the combo box to it's original
status (as it was when the form was opened), I want to say abracadabra (with
code) to make it look that way again.

Is this possible?
Bernie


Jeff Boyce said:
I asked the questions I did because the description didn't provide enough
clues. You might be surprised to learn how often folks post question in
these newsgroups that have nothing whatsoever to do with the title of the
newsgroups.

A combo box has a source (e.g., a query<preferably> or a table) and a
number
of fields from that source. Typically, the "bound column" is the first
one,
and that one is typically the ID field, usually numeric. To prevent that
field from being seen, its column width is set to zero.

In addition, the combo box's source contains at least one additional
field,
usually text and more user-friendly. The column width of this field is
set
to some non-zero value.

Since the bound column is numeric, to set the default value property of
the
combo box, you'd need to give it a numeric value. Because the combo box
DISPLAYS the text value that corresponds to that numeric value, it appears
you've given the combo box a text value for a default (but you haven't).

Is there a chance that the underlying field in the table is defined as a
Lookup datatype? If so, you've encountered one of the strong reasons not
to
use this datatype -- what it shows and what it stores are two different
things...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


bw said:
I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore using
MS
Access and working in a form. This is an application that I've written for
personal use.

My original question is poorly presented, so I have presented it again in a
more understandable form.

If the combo box displays a numeric value, how does it display a non-numeric
value for a default value, and once it does, how do I make it display
that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if
you
wish.


Jeff Boyce said:
Are you using MS Access? Is this a commercial application or one
you've
written?

Are you working in a form? We aren't there, we can't see what you're
doing.

I have no idea what code you might have behind your command buttons, or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually, they
STORE a numeric value, but display a text value to make it easier on
the
user. Which of the fields "feeding" your combo box is marked as the Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


When I first click on the CancelFlightButton, the Default Value
"Select a
Flight" appears in the ComboBox. After the first click, I am unable
to
set the value of the ComboBox to "Select a Flight" again, as the ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value =
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans =vbYes, I do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set this to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
J

Jeff Boyce

How have you "specified" a default value?

Re-check my previous post ... what are you using for a source for your combo
box?

In code, can you just set the (numeric) value of the combo box to the
numeric value that corresponds to the text that is displayed?

Does the underlying table use a Lookup datatype?

Regards

Jeff Boyce
Microsoft Office/Access MVP

bw said:
Thanks for the reply, Jeff.
Is there a chance that the underlying field in the table is defined as a
Lookup datatype?
No, the underlying field is defined as a Number Data Type.

I'm sorry to be so dense, but I just don't get what you're saying.
When the FORM OPENS, the combo box displays the default value I have
specified, which is "Select a Flight".
When I have decided (via code) to "restore" the combo box to it's original
status (as it was when the form was opened), I want to say abracadabra
(with code) to make it look that way again.

Is this possible?
Bernie


Jeff Boyce said:
I asked the questions I did because the description didn't provide enough
clues. You might be surprised to learn how often folks post question in
these newsgroups that have nothing whatsoever to do with the title of the
newsgroups.

A combo box has a source (e.g., a query<preferably> or a table) and a
number
of fields from that source. Typically, the "bound column" is the first
one,
and that one is typically the ID field, usually numeric. To prevent that
field from being seen, its column width is set to zero.

In addition, the combo box's source contains at least one additional
field,
usually text and more user-friendly. The column width of this field is
set
to some non-zero value.

Since the bound column is numeric, to set the default value property of
the
combo box, you'd need to give it a numeric value. Because the combo box
DISPLAYS the text value that corresponds to that numeric value, it
appears
you've given the combo box a text value for a default (but you haven't).

Is there a chance that the underlying field in the table is defined as a
Lookup datatype? If so, you've encountered one of the strong reasons not
to
use this datatype -- what it shows and what it stores are two different
things...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


bw said:
I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore using
MS
Access and working in a form. This is an application that I've written for
personal use.

My original question is poorly presented, so I have presented it again
in a
more understandable form.

If the combo box displays a numeric value, how does it display a non-numeric
value for a default value, and once it does, how do I make it display
that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if
you
wish.


Are you using MS Access? Is this a commercial application or one
you've
written?

Are you working in a form? We aren't there, we can't see what you're
doing.

I have no idea what code you might have behind your command buttons,
or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually, they
STORE a numeric value, but display a text value to make it easier on
the
user. Which of the fields "feeding" your combo box is marked as the Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


When I first click on the CancelFlightButton, the Default Value
"Select a
Flight" appears in the ComboBox. After the first click, I am unable
to
set the value of the ComboBox to "Select a Flight" again, as the ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value =
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans =vbYes,
I do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set
this to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
B

bw

How have you "specified" a default value?
By entering "Select a Flight", in the Default Value on the Data Tab, of the
Properties for the Combo Box.
Re-check my previous post ... what are you using for a source for your
combo box?
SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
In code, can you just set the (numeric) value of the combo box to the
numeric value that corresponds to the text that is displayed?
I wouldn't know how to do this.
Does the underlying table use a Lookup datatype?
No

I hope this helps you to help me...


Jeff Boyce said:
How have you "specified" a default value?

Re-check my previous post ... what are you using for a source for your
combo box?

In code, can you just set the (numeric) value of the combo box to the
numeric value that corresponds to the text that is displayed?

Does the underlying table use a Lookup datatype?

Regards

Jeff Boyce
Microsoft Office/Access MVP

bw said:
Thanks for the reply, Jeff.
Is there a chance that the underlying field in the table is defined as a
Lookup datatype?
No, the underlying field is defined as a Number Data Type.

I'm sorry to be so dense, but I just don't get what you're saying.
When the FORM OPENS, the combo box displays the default value I have
specified, which is "Select a Flight".
When I have decided (via code) to "restore" the combo box to it's
original status (as it was when the form was opened), I want to say
abracadabra (with code) to make it look that way again.

Is this possible?
Bernie


Jeff Boyce said:
I asked the questions I did because the description didn't provide enough
clues. You might be surprised to learn how often folks post question in
these newsgroups that have nothing whatsoever to do with the title of
the
newsgroups.

A combo box has a source (e.g., a query<preferably> or a table) and a
number
of fields from that source. Typically, the "bound column" is the first
one,
and that one is typically the ID field, usually numeric. To prevent
that
field from being seen, its column width is set to zero.

In addition, the combo box's source contains at least one additional
field,
usually text and more user-friendly. The column width of this field is
set
to some non-zero value.

Since the bound column is numeric, to set the default value property of
the
combo box, you'd need to give it a numeric value. Because the combo box
DISPLAYS the text value that corresponds to that numeric value, it
appears
you've given the combo box a text value for a default (but you haven't).

Is there a chance that the underlying field in the table is defined as a
Lookup datatype? If so, you've encountered one of the strong reasons
not to
use this datatype -- what it shows and what it stores are two different
things...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore using
MS
Access and working in a form. This is an application that I've written
for
personal use.

My original question is poorly presented, so I have presented it again
in
a
more understandable form.

If the combo box displays a numeric value, how does it display a
non-numeric
value for a default value, and once it does, how do I make it display
that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if
you
wish.


Are you using MS Access? Is this a commercial application or one
you've
written?

Are you working in a form? We aren't there, we can't see what you're
doing.

I have no idea what code you might have behind your command buttons,
or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually,
they
STORE a numeric value, but display a text value to make it easier on
the
user. Which of the fields "feeding" your combo box is marked as the
Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


When I first click on the CancelFlightButton, the Default Value
"Select
a
Flight" appears in the ComboBox. After the first click, I am unable
to
set the value of the ComboBox to "Select a Flight" again, as the
ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a
Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following
code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value =
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans =vbYes,
I
do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set
this
to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 
J

Jeff Boyce

You enter a text value ("Select a Flight") in the Default Value property.

Your combobox source is tblSelectMainReport.RequestNum ... I'll get this is
a number.

How can your combobox's value be both a text value and a numeric value?!

By the way, because your source has only one field
(tblSelectMainReport.RequestNum), the combo box will ONLY be able to display
one field, a number (aside from the creative way you've stuffed a text value
in as an initial Default).

I'm guessing that there's a field in tblSelectMainReport that holds text
values. Consider including that field as part of your SELECT statement, and
setting the Column Width property accordingly.

I'm getting an inkling that what you are trying to do is provide a combo box
that holds an instruction ("Select a Flight") to help the user know what to
do. The value that you select/store via this combo box will NEVER be one
that corresponds to a value of "Select a Flight", right?!

As an alternate approach, you could set the Tool Tip property value to
"Select a Flight" and leave the combo box empty.

If you wish to provide the user with a prompt inside the combo box (i.e.,
"Select a Flight"), you could use a UNION query to combine two queries. The
first only returns the "Select a Flight" value, while the second returns the
values from tblSelectMainReport. It might look something like:

SELECT 0, "Select a Flight" FROM tblSelectMainReport
UNION
SELECT DISTINCT tblSelectMainReport.RequestNum,
tblSelectMainReport.Description
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));

Hopefully one of those ideas gets you closer...

Regards

Jeff Boyce
Microsoft Office/Access MVP


bw said:
How have you "specified" a default value?
By entering "Select a Flight", in the Default Value on the Data Tab, of
the Properties for the Combo Box.
Re-check my previous post ... what are you using for a source for your
combo box?
SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
In code, can you just set the (numeric) value of the combo box to the
numeric value that corresponds to the text that is displayed?
I wouldn't know how to do this.
Does the underlying table use a Lookup datatype?
No

I hope this helps you to help me...


Jeff Boyce said:
How have you "specified" a default value?

Re-check my previous post ... what are you using for a source for your
combo box?

In code, can you just set the (numeric) value of the combo box to the
numeric value that corresponds to the text that is displayed?

Does the underlying table use a Lookup datatype?

Regards

Jeff Boyce
Microsoft Office/Access MVP

bw said:
Thanks for the reply, Jeff.

Is there a chance that the underlying field in the table is defined as
a Lookup datatype?
No, the underlying field is defined as a Number Data Type.

I'm sorry to be so dense, but I just don't get what you're saying.
When the FORM OPENS, the combo box displays the default value I have
specified, which is "Select a Flight".
When I have decided (via code) to "restore" the combo box to it's
original status (as it was when the form was opened), I want to say
abracadabra (with code) to make it look that way again.

Is this possible?
Bernie


message I asked the questions I did because the description didn't provide
enough
clues. You might be surprised to learn how often folks post question
in
these newsgroups that have nothing whatsoever to do with the title of
the
newsgroups.

A combo box has a source (e.g., a query<preferably> or a table) and a
number
of fields from that source. Typically, the "bound column" is the first
one,
and that one is typically the ID field, usually numeric. To prevent
that
field from being seen, its column width is set to zero.

In addition, the combo box's source contains at least one additional
field,
usually text and more user-friendly. The column width of this field is
set
to some non-zero value.

Since the bound column is numeric, to set the default value property of
the
combo box, you'd need to give it a numeric value. Because the combo
box
DISPLAYS the text value that corresponds to that numeric value, it
appears
you've given the combo box a text value for a default (but you
haven't).

Is there a chance that the underlying field in the table is defined as
a
Lookup datatype? If so, you've encountered one of the strong reasons
not to
use this datatype -- what it shows and what it stores are two different
things...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/


I guess I don't understand your questions. This is the
microsoft.public.access.formscoding Newsgroups, so I am therefore
using MS
Access and working in a form. This is an application that I've
written
for
personal use.

My original question is poorly presented, so I have presented it again
in
a
more understandable form.

If the combo box displays a numeric value, how does it display a
non-numeric
value for a default value, and once it does, how do I make it display
that
default value again?

Please see "ReUse Default Value with Combo Box" in this Newsgroups, if
you
wish.


Are you using MS Access? Is this a commercial application or one
you've
written?

Are you working in a form? We aren't there, we can't see what
you're
doing.

I have no idea what code you might have behind your command buttons,
or
what controls you have.

It is rare to use a combo box to display a numeric value -- usually,
they
STORE a numeric value, but display a text value to make it easier on
the
user. Which of the fields "feeding" your combo box is marked as the
Bound
Column?

Regards

Jeff Boyce
Microsoft Office/Access MVP


When I first click on the CancelFlightButton, the Default Value
"Select
a
Flight" appears in the ComboBox. After the first click, I am
unable to
set the value of the ComboBox to "Select a Flight" again, as the
ComboBox
is a numeric field.

How do I reset the value in the ComboBox so it displays "Select a
Flight"
as it did the first time?
Thanks for your help. If you need more information, please ask me.

The following are some particulars of my application.
I have a Command Button "CancelFlightButon" which has the following
code:

Private Sub CancelFlightButton_Click()
CancelFlight.Visible = True
cboCancelFlight.SetFocus
CancelFlightButton.Visible = False
End Sub

I have the following unbound Combo Box , which has a Default Value
=
"Select a Flight", and it is hidden behind the "CancelFlightButton"
Command Button. The Combo Box has the following code (if ans
=vbYes, I
do
something else):

Private Sub cboCancelFlight_Click()
Dim ans
ans = MsgBox("Are you sure you want to delete Request Number " &
CancelFlight & "?", 36, "Be Sure")
If ans = vbNo Then
cboCancelFlight = Null...................I have tried to set
this
to
"Select a Flight", but I get a syntax error.
CancelFlightButton.Visible = True
CancelFlightButton.SetFocus
cboCancelFlight.Visible = False
Exit Sub
End If
End Sub

The RowSource for cboCancelFlight is as follows:

SELECT DISTINCT tblSelectMainReport.RequestNum
FROM tblSelectMainReport
WHERE (((Nz([RequestNum],0)) Between 1 And 10));
 

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