Using values from a text box in row source

jbfraleigh

Registered User.
Local time
Today, 05:22
Joined
Aug 8, 2000
Messages
22
I have a combo box which has a table/query row source type. For the row source, I want to use a query that contains some data from text boxes on the form. I'm currently trying:

SELECT [LAB],[COAT] FROM [University] WHERE [COLOR]=tbColor.value AND [TYPE]=tbType.value;

Although this is a valid query, I don't get any results when used as a row source. No errors, just no results.

Thanks in advance...
 
this is the format to refer to a textbox in a form:

[Forms]![FormName]![ControlName]
 
When I try this, it asks for a parameter value. For clarification, I'm using the following:

SELECT [LAB],[COAT] FROM [University] WHERE [COLOR]=[Forms]![SomeForm]![tbColor] AND [TYPE]=[Forms]![SomeForm]![tbType];

It should probably be noted that SomeForm is a subform. I've tried a few other random things, such as [Forms]![MainForm]![Subform]![Control] with pretty much the same results..
 
Try this:
[Forms]![MainForm]![Subform].Form![Control]
 
I'm still having trouble with this one - No matter what I try, it keeps asking for a parameter value.

Assuming I refer to the subform, should I be using it's "real" name (the source object property) or the name used on the main form (the name property).

Thanks in advance for any help!
 
You need to use the Name property of the subformcontrol on the mainform, NOT the actual form name.
 

Users who are viewing this thread

Back
Top Bottom