Cannot select specific numbers within a form

S

Sreya

Hello...I'm having a bit of troublw with selecting a specific field in
a table. What I need is to select a field called OOS Number from a
table called OOS# table. This is the code I have:

Code:
--------------------------------------------------------------------------------

SELECT Distinct [OOS# table].[OOS Number] AS [OOS] FROM [OOS# table]
ORDER BY [OOS# table].[OOS Number];
--------------------------------------------------------------------------------
it gives me ALL the OOS Numbers, not just the specific one that goes
with the record. How do I make it so that, as soon as I scroll
down...and as the Test numbers are scrolling down, only the specifc
numbers are in the value list of the combobox. Meaning, One test# can
have multiple OOS Numbers...and for one Test #, the combo box should
contain only those numbers that go with that certain Test #.
Any suggestion would be helpful. Thanks in advance.
-Sreya
 
M

Michel Walsh

Hi,


You have to add a WHERE clause, like

Me.ListBoxControl.RowSource= "SELECT *
FROM myTable
WHERE testNumber=FORMS!FormName!ComboBoxName"




If you don't use a RowSource, a ControlSource or DoCmd, you would have to
embed the value in the query, rather than referring to its holder (the combo
box name).



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top