Solved

Combo box on MS Access form

Posted on 2011-02-22
13
433 Views
Last Modified: 2012-08-13
I have a form based on a query, it is a basic Support Call logging form. I have a combo box on the form and I can select Engineers names within that combo box and change the data shown on the form. I have done this with a criteria in the select query ([Forms]![Call Log Listing]![engineer]).
I would like to be able to enter "ALL" in the combo box so as to show all records on the form regardless of Engineer.
Any ideas gratefully rcvd
Iain
0
Comment
Question by:iainmacleod
  • 7
  • 6
13 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34951864
see this link for instruction
How to add '(all)' to a combo box or a list box control in an Access 2000 application

http://support.microsoft.com/?kbid=210290
0
 

Author Comment

by:iainmacleod
ID: 34952452
Thanks for that, however I am struggling with it. I am using Access 2010??
Does that make a difference?
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34952633
No..

post the rowsource of your combo box..
0
 

Author Comment

by:iainmacleod
ID: 34952901
I must be missing something basic in this, my row source type is AddAllToList and my row source is a Table that contains a list of engineers names. I dont understand where to paste the AddAllToList function on the form....
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34952966
use a query as the rowsource of the combo box
something like this

select engineernames from tableName

what is the name of the table and field names that has the engineer names?
0
 

Author Comment

by:iainmacleod
ID: 34953174
Ok got that working: SELECT Username from ENGINEERS
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:iainmacleod
ID: 34953252
Still not sure about the rest of it though. Where do i put the code that allows "ALL"??
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34953288
to add <All> to the selection, you have to use a union query as described in the link posted above.

SELECT Username from ENGINEERS
Union
SELECT '<All>'  from ENGINEERS
0
 

Author Comment

by:iainmacleod
ID: 34953450
I am afraid I am still not getting it.
I now can select "ALL" in my combo box, but I do not get any records displayed, I change to an engineers name and I get his jobs.
Must be missing something or just being a little dim. Thanks for your help so far.
Iain
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34953501
post the SQL statement of the query where you are using the combo box as filter..
0
 

Author Comment

by:iainmacleod
ID: 34959569
Sorry, i am not getting this:
I have a select query that my form that contains the combo box is based on:

SELECT [Call Logging].*, [Call Logging].[Allocated Engineer]
FROM [Call Logging]
WHERE ((([Call Logging].[Allocated Engineer]) Like [Forms]![Call Log Listing]![engineer]));

My row source of the combo box is:

SELECT Username from ENGINEERS
UNION SELECT 'All'  from ENGINEERS;

When I select an Engineer in the combo box my form displays all of that engineers bookings fine, When I select ALL in my combo box I would like to see all engineers bookings.

Thanks for your patience
Iain
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34960390
try this query, copy and paste


SELECT [Call Logging].*
FROM [Call Logging]
Where IIF([Forms]![Call Log Listing]![engineer]="All",[Allocated Engineer], [Call Logging].[Allocated Engineer] = [Forms]![Call Log Listing]![engineer])
0
 

Author Closing Comment

by:iainmacleod
ID: 34962169
Many thanks for all of your help... That worked a treat.
Best regards
Iain
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mysql joining from the same table 6 37
Search Form not Querying 2 12
Access Query based on a Form Field 2 22
Common Records between Sub Queries 4 14
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

863 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

25 Experts available now in Live!

Get 1:1 Help Now