Solved

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

Posted on 2010-09-16
13
957 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 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

786 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