RE: Adding to a combo box list that is based on a table



I want the default selection to be the add new. From my testing (maybe my
fault) I am not able to get this on the combo box. It is blank. I set the
row source to a table, set the default value to "[Add New]". Am I missing
something?

"Klatuu" wrote:

Even though you are using mutliple tables for your query, it still return
rows made up of the fields in the query. The UNION part just has to match
the list of fields returned by the query.

But, I am curious as to why you think Jeff's suggestion will not work for
you. It really is the easier way to do this. If you can explain why you
think that, perhaps we can offer a suggestion on how to make it work.
--
Dave Hargis, Microsoft Access MVP


"Pat" wrote:

Again thanks for your reply. I did a little research and the UNION appears
to require as you have said like tables. Since my query is referencing 3
seperate tables, how would I include the UNION statement? I am a little
green in this area, your help is very much appreciated.

"Klatuu" wrote:

You can do this with an UNION query. You just have to create dummy values.
With a Union Query, there has to be an equal number of fields and the field
data types have to match. You also need to have an ORDER BY that will cause
your [Add New Item] field to be the first item in the list. Here is an
example that may help. Assume you have an Autonumber field as the first
field you will want sort on, and a description field to display in the combo,
then a text field and another Long Integer field in the table. You can mock
up the Union side:

SELECT [KeyFld], [DescriptionField], [BarrellType], [BarrellLength] FROM
tblGuns UNION SELECT 0 as Dummy, "[Add New Item]" As [DescriptionField], ""
As [BarrellType], 0 As [BarrellLength] FROM tblGuns ORDER BY [KeyFld];

Then to make [Add New Item] the default, use the form Current Event to
select then item. This assumes the Bound Column property of your combo is 1:

Me.MyCombo = 0

--
Dave Hargis, Microsoft Access MVP


"Pat" wrote:

I would like to be able to have my combo box have an item at the top and be
the default selection. Something like "[Add New Item]". The row source is a
query to a few tables. I can't see a way without have a record in the source
table.

And if it makes any difference, the source is a query that using a concat of
several fields to display, but the bound column is column 2, the record ID.

Here is the query I am using for the source.

SELECT [a_caliber] & " " & [dbtbullet_lst].[b_weight] & "g " &
[dbtbullet_lst].[b_mfg] & " " & [dbtbullet_lst].[b_type] & ", " & [a_charge]
& "g " & [dbtpowder_lst].[mfg] & " " & [dbtpowder_lst].[desc] AS expr1,
dbtReloadRecipe.recipe_id, dbtReloadRecipe.a_caliber FROM dbtPowder_lst INNER
JOIN (dbtBullet_lst INNER JOIN dbtReloadRecipe ON dbtBullet_lst.bulletID =
dbtReloadRecipe.a_bulletID) ON dbtPowder_lst.powderID =
dbtReloadRecipe.a_powderID WHERE
(((dbtReloadRecipe.a_caliber)=[Forms]![frmMaintainReloads]![r_caliber]));

Any ideas?

.



Relevant Pages

  • Re: Cascading Combo Boxes in a continuous subform
    ... So, if you filter the combo so that the display value needed on other rows is not available, you make it go blank. ... You set up the combo so its Column Count is 2, the Bound column is 1, and the Column Widths makes this column zero-width. ... If you can't do that for some reason, another alternative is to create a query as the source for your form. ... This query can output the CategoryName as well as the CategoryID that the combo is bound to. ...
    (microsoft.public.access.forms)
  • Re: Combining records from two queries
    ... combining UNION and SELECT queries to best effect. ... The list in each case has to have the same number & types of fields (for example, if the first Query begins with a Date/Time field, the second one should do so as well). ... I like to keep my Union Queries short and simple and do the rest of the work elsewhere. ... tblMentors comprises Subject Mentors and Professional Mentors and the Placement subform has a combo for each - the Subject Mentor combo puts the chosen MentorID in the SubjectMentorID field and the Professional Mentor combo puts the chosen MentorID in the ProfessionalMentorID field. ...
    (microsoft.public.access.queries)
  • Re: Marsh...you were right!! HELP please!
    ... >there is no way to keep the RowSource query in a dependent ... >the display problem you had before we added the Requery to ... >user change the cbo if they need to? ... If the combo box's bound column is not visible (the combo ...
    (microsoft.public.access.formscoding)
  • Re: Graphical Union-Query Builder?
    ... If you are limiting the input in each of the sub-queries in your Union ... Use the filtered queries as the input to your Union query: ... Most "functional IT users" will not know anything about SQL. ... I didn't know that fields of subsequent queries in a Union could have ...
    (microsoft.public.access.queries)
  • Re: Help! Union Query has started crashing!
    ... It's tblSupport on the RLR_SUPPORT_INFOTERRA.mdb database. ... I think I have tracked the problem down to the query ... I also tried a UNION ALL, ... the actual structure of the queries as they have been running fine for weeks. ...
    (microsoft.public.access.queries)

Loading