SQL Where Clause Syntax

I

ISee

Hoping for help..

I can't for the life of me figure out the strange (but
powerful) synatx for the WHERE clause in SQL. I'm hoping
someone can guide in the right direction on this.

I have two comboboxes on a form; combobox-#1 is populated
with the names of three tables (e.g. Table-A, Table-B,
and Table-C). When an item in combobox-#1 is selected,
combobox-#1's OnChange event is used to run a macro which
populates combobox-#2 with specified field-date of the
Table selected in combobox-#1. I have this synchronize
all it works as intended.

My problem is, I also have another unbound text box on
the form which I would like to display related record
data for the field-data-item selected in combobox-#2.

To clarify, if I selected Table-B in combobox-#1 (and
Table-B consisted of two fields), combobox-#2 would be
populated with field-1 data from all records in Table-B.
After selecting one of the field-1 items in combobox-#2,
the textbox on the form would displayed the field-2 data
associated with field-1 record selected in combobox-#2.
In short, I need an SQL statement with a Where clause
that says -- search the Table Selected in Combobox-#1,
and using the field associated with combobox-#2, and
display the remaining data of the record found (field-2)
in the textbox.

My SQL statement reads as follows:

'SELECT MyTable-B.Field1 FROM MyTable-B WHERE (((MyTable-
B.Field1) = Combobox-#2.Column(0)));'

I'm throwing this into macro and using the SetValue
command - and entering the SQL statement in the
expression part of the SetValue command. Doesn't work!!!

Help - what am I doing wrong?

Thanks in advance for any help given.
 

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