Solved

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

Posted on 2010-09-16
13
934 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
  • 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 119

Expert Comment

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

me.comboName=""

that will make the combo blank
0
 

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 119

Expert Comment

by:Rey Obrero
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now