In the application I am developing, I have a Quotes form. On that form is a Combo Box which is populated by a SQL query statically entered into the control.
I have the Combo Box control bound to Col #2 which is the unique ID of the record, and that field is not displayed in the Combo Box list.
The quotes form also displays the records in FE temp table tmptblqry_quotes.
Which ever the selected quote is in the combo box, that record is located when the form opens / refreshes and is the selected record.
That is all working very well. And thus "one more requirement" has crept in...
Not all parts in the application I am building will have quotes on file... such as all of the current production parts. So I need to statically add as the top entry of the Combo Box 'Production Part - Refers to JDE' and have the ID which means that value be some impossible value, such as -1.
I do not want that choice to show up in the multiple records grid... just in the Combo Box. Temporarily adding a special record would end up showing up as a Quote record in the Multiple Records grid view!
I came across this page:
"How do I... Add items to an Access combo box on the fly?"
http://www.techrepublic.com/blog/howdoi/how-do-i-add-items-to-an-access-combo-box-on-the-fly/201
and it appears their example actually adds the record to the table which populates the pick list. (Which is what I do NOT want to do.)
How do I add an additional entry to a Combo Box which is being populated by a SQL Query without needing to really add it to the table?
I have tried already UNION ALL, and that will not work as UNION ALL in Access / Jet requires a FROM for each SELECT. So while:
works by itself, it will not work with UNION ALL.
Code:
SELECT t.id & ' / ' & t.vendortitle AS [ID / Vendor:],t.id,t.rev AS [Rev:],t.ver AS [Ver:],t.poprice AS [Price:] FROM tmptblqry_quotes AS t ORDER BY t.rev,t.ver,t.vendortitle
The quotes form also displays the records in FE temp table tmptblqry_quotes.
Which ever the selected quote is in the combo box, that record is located when the form opens / refreshes and is the selected record.
That is all working very well. And thus "one more requirement" has crept in...
Not all parts in the application I am building will have quotes on file... such as all of the current production parts. So I need to statically add as the top entry of the Combo Box 'Production Part - Refers to JDE' and have the ID which means that value be some impossible value, such as -1.
I do not want that choice to show up in the multiple records grid... just in the Combo Box. Temporarily adding a special record would end up showing up as a Quote record in the Multiple Records grid view!
I came across this page:
"How do I... Add items to an Access combo box on the fly?"
http://www.techrepublic.com/blog/howdoi/how-do-i-add-items-to-an-access-combo-box-on-the-fly/201
and it appears their example actually adds the record to the table which populates the pick list. (Which is what I do NOT want to do.)
How do I add an additional entry to a Combo Box which is being populated by a SQL Query without needing to really add it to the table?
I have tried already UNION ALL, and that will not work as UNION ALL in Access / Jet requires a FROM for each SELECT. So while:
Code:
SELECT 'Production Part - Refers to JDE' AS [ID / Vendor:],-1 AS [id],-1 AS [Rev:],-1 AS [Ver:],-1 AS [Price:]