Solved

How do I set a combo box to default blank field?

Posted on 2010-09-16
13
983 Views
Last Modified: 2012-05-10
I have a combo box in Microsoft Access 2007 that obtains its list of values from a query.  What I want is for the combo box to initially set to a blank field.  I want to preserve the rowsource values being driven by the query (in other words, I don't want to switch to a Value List, as the values in the main db may change in the future and I don't want to manually key those in later on).

Is there a way to do this?

Thanks!
0
Comment
Question by:kmartinenko
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 1

Expert Comment

by:d_j_twilight
ID: 33696449
Questions:

1. Is it possible to include a blank in the selection query that generates the combo box list?

2. If the user doesn't make a selection (e.g. they leave that field as a blank when they submit the form, will that cause problems in your app?
0
 

Author Comment

by:kmartinenko
ID: 33696578
d_j_twilight:
1.  No as the query is from a large table and it cannot and should not have any blank values.
2.  Perhaps, but its really for asthetic purposes to have the blank there.  I have a Me.combobox.requery afterupdate command that will reset the combo box after a procedure is performed (I am building a form that performs multiple queries and then generates custom reports).  I simply want the combo box to reset itself to a blank setting after the initial report has been executed, as to allow a new user or the same user to start over again with a new report.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33696608
to clear the selection in the combo box,

me.comboName=""

that will make the combo blank
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:kmartinenko
ID: 33696745
Capircorn1:

Thanks...but where do I place this command?  
0
 
LVL 1

Expert Comment

by:d_j_twilight
ID: 33696831
In the "After Update" event procedure.

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33697095
you already said it here ..

< I simply want the combo box to reset itself to a blank setting after the initial report has been executed, as to allow a new user or the same user to start over again with a new report.>

so after opening the report..

me.comboName=""
0
 
LVL 10

Accepted Solution

by:
t_hungate earned 500 total points
ID: 33697309
It sounds like you probably would also want to place ="" in you on form open as well.  Depending on what you do with the form while you are running your report.

TLH
0
 

Author Closing Comment

by:kmartinenko
ID: 33705940
Yep, that was it.  Actually, I placed it in form load() instead of open but you jogged my memory as to what I have done in the past. I have done this type of stuff before but just had a major brain freeze...thanks for helping out.
0
 
LVL 10

Expert Comment

by:t_hungate
ID: 33706183
Glad that we could help.

TLH
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33706193
just to let you know

an unbound combo box always is null when you open the form.,

so, can you tell me how you clear the combo after you run the report?
0
 

Author Comment

by:kmartinenko
ID: 33707034
capricorn1:

Thanks, and yes, I realized that.  The combo box selections must be reset after the initial report is run, so I  included a Me.my_combobox.Requery command in the AfterUpdate() sub procedure.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33707683
so, why did you accept the comment at http:#a33697309 as an answer, when in fact you don't need it at all?
0
 

Author Comment

by:kmartinenko
ID: 33720004
I needed the answer capricorn1...it may not have been the *exact* answer, but in the context of my situation, it worked for me, so I accepted a33697309 as the solution.  thats how I roll.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question