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

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Select Query Using Combo Box, Office 2010    
 
   
BillR
post Feb 6 2012, 07:05 AM
Post #1

UtterAccess Addict
Posts: 179



I want to set the criteria of a query by the use of a combo box. I'm not sure where to begin with this... Can anyone point me in the right direction?
Go to the top of the page
 
+
jleach
post Feb 6 2012, 07:25 AM
Post #2

UtterAccess Editor
Posts: 6,719
From: Capital District, NY, USA



Hi,

Depending on the context, a few ways would be to use the Expression Services to reference the combo from your query:

CODE
SELECT * FROM SomeTable WHERE SomeField = [Forms]![FormName]![ComboBoxName]


or maybe use the AfterUpdate event of the combo to build a dynamic SQL statement:

CODE
Dim strSQL As String

strSQL = "SELECT * FROM SomeTable WHERE SomeField = """ & Me.ComboBoxName & """"

someobject.Recordsource = strSQL


hth
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: 24th May 2013 - 05:35 AM