How can I add a blank row to a combo box? (1 Viewer)

JC10001

Registered User.
Local time
Today, 22:22
Joined
Sep 24, 2003
Messages
48
I have a combo box that gets its data from a select statement. It works fine. When the form loads the combo box automatically sets its value based on the value of a variable stored in a record of the database. When the combo box changes so does the value stored in that record.

What I would like to do is insert a blank row before all of the other selections so that the users can choose "nothing/blank" as an answer...thereby setting that field in the table to "nothing/blank".

How would I go about doing this?
 
Last edited:

ColinEssex

Old registered user
Local time
Today, 22:22
Joined
Feb 22, 2002
Messages
9,124
When you say "nothing/blank" do you mean you want "All" to be selected as opposed to the one they select?

Col
 

JC10001

Registered User.
Local time
Today, 22:22
Joined
Sep 24, 2003
Messages
48
ColinEssex said:
When you say "nothing/blank" do you mean you want "All" to be selected as opposed to the one they select?

Col

I mean nothing at all is selected. The combo box would have/store no value.

Is there a way to say...

SELECT (a blank row) and * FROM table?
 
Last edited:

Mile-O

Back once again...
Local time
Today, 22:22
Joined
Dec 10, 2002
Messages
11,316
Why? What is your thinking? Nobody in their right mind would store a blank row.
 

JC10001

Registered User.
Local time
Today, 22:22
Joined
Sep 24, 2003
Messages
48
I figured it out, and yes, I DO NEED to store a blank row sometimes....like when the data is changed from something to nothing.

Here is what I used:

SELECT tableA.field1, tableA.field2 FROM tableA UNION SELECT "", "" FROM table A ORDER BY tableA.field1 tableA.field2;
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:22
Joined
Feb 28, 2001
Messages
27,285
SJ, "right mind" is a strong term here. I think there are times when an answer of "nothing" is appropriate. However, I would agree that a true BLANK might not always be the answer.

JC, the following string is a blank. " "

The space in the middle makes it a BLANK string, not an EMPTY string. You can use it anywhere you could have used "A" as a possible value. Beware that the following string is an EMPTY string. ""

You want to avoid empty strings (and null strings) as much as possible. Access really doesn't like those two oddball strings.

I'm guessing that the reason SJ was a little harsh is that some queries and some other Access syntax makes it harder to work with a blank. But you know, if you gotta have it, you gotta have it.
 

Users who are viewing this thread

Top Bottom