Solved

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

Posted on 2010-09-16
13
974 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 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