UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Add A 'blank' Row To Combo Box - Query Rowsource    
 
   
edaroc
post Feb 25 2010, 09:28 AM
Post #1

UtterAccess Guru
Posts: 996
From: Rochester NY USA



Having a problem using the Search function with the #characters limit ... Add & row

Have a combo box, part of a record search section on the form, and want to add a blank row to the rowsource - which is to be interpreted as 'No Filtering' on this field.

The Select statement is currently:
SELECT tblInkRequests.CSRId, First(SALESAGENT.SANAME) AS CSRName
FROM tblInkRequests LEFT JOIN SALESAGENT ON tblInkRequests.CSRId = SALESAGENT.SACODE
GROUP BY tblInkRequests.CSRId
ORDER BY First(SALESAGENT.SANAME);

How would this be modified to add a blank (or NULL) row?
Go to the top of the page
 
+
doctor9
post Feb 25 2010, 09:32 AM
Post #2

UtterAccess VIP
Posts: 9,300
From: Wisconsin



Ed,

You may want to check out Adding "All" to a listbox or combobox at the Access Web. It sounds like what you're trying to do.

Hope this helps,

Dennis
Go to the top of the page
 
+
edaroc
post Feb 25 2010, 10:19 AM
Post #3

UtterAccess Guru
Posts: 996
From: Rochester NY USA



QUOTE (doctor9 @ Feb 25 2010, 02:32 PM) *
Ed,
You may want to check out Adding "All" to a listbox or combobox at the Access Web. It sounds like what you're trying to do.
Hope this helps,
Dennis

Your suggestion helped in a round about way...
Kept getting 'aggregate' errors using the UNION query approach (maybe I had a typo error I wasn't detecting). But, I googled using your website reference 'Adding "All"...' and found another solution using DISTINCT.

This works great:
SELECT DISTINCT tblInkRequests.CSRId, SALESAGENT.SANAME AS CSRName FROM tblInkRequests LEFT JOIN SALESAGENT ON tblInkRequests.CSRId = SALESAGENT.SACODE UNION SELECT Null as CSRId, "" As CSRName from tblInkRequests ORDER BY CSRName
FROM tblInkRequests LEFT JOIN SALESAGENT ON tblInkRequests.CSRId = SALESAGENT.SACODE

Thanks for the guidance.

OOPS! That didn't work! I've got to go back to the totals query ... Forgot DISTINCT is distinct on combination of all the columns in a row, not the column it precedes. I'll post an update after working on this.
Go to the top of the page
 
+
edaroc
post Feb 25 2010, 10:55 AM
Post #4

UtterAccess Guru
Posts: 996
From: Rochester NY USA



Final Results Are In And It's Working ... Phew.

Here's the query:
SELECT tblInkRequests.CSRId, First(SALESAGENT.SANAME) AS CSRName
FROM tblInkRequests
LEFT JOIN SALESAGENT ON tblInkRequests.CSRId = SALESAGENT.SACODE
GROUP BY tblInkRequests.CSRId
UNION
SELECT Null as CSRId, "" As CSRName FROM tblInkRequests
ORDER BY CSRName;

I must have had a typo before.
Go to the top of the page
 
+
doctor9
post Feb 26 2010, 09:12 AM
Post #5

UtterAccess VIP
Posts: 9,300
From: Wisconsin



Glad I could help!

Dennis
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 10:50 PM