Form builder, linked combo boxes help

P

Paula

I am trying to create a form with Linked Combo Boxes and have hit a
snag. On the second combo box in my query I have the following as the
Row Source:

SELECT [tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]

I want the form to show me all of the items in the Services table that
match the selected item from the Category table. I am receiving the
following error:

Syntax error (missing operator) in query expression
'[tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]'

Can anyone help me with this please!
 
J

Jeff L

When you write an SQL statment, you refer to fields in tables/queries
with a dot (.) not a bang (!). So it should be
[tblServices].[Services]

Hope that helps!
 
P

Paula

Thank you for the tip, unfortunately, that didn't work either.

SELECT [tblServices].[Services] WHERE [tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

Same missing operator error comes up.



Jeff said:
When you write an SQL statment, you refer to fields in tables/queries
with a dot (.) not a bang (!). So it should be
[tblServices].[Services]

Hope that helps!

I am trying to create a form with Linked Combo Boxes and have hit a
snag. On the second combo box in my query I have the following as the
Row Source:

SELECT [tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]

I want the form to show me all of the items in the Services table that
match the selected item from the Category table. I am receiving the
following error:

Syntax error (missing operator) in query expression
'[tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]'

Can anyone help me with this please!
 
J

Jeff L

You forgot your From

SELECT [tblServices].[Services]
From tblServices
WHERE [tblServices].[Services] =
Forms![frmLinkedControls]![cboCategory]
Thank you for the tip, unfortunately, that didn't work either.

SELECT [tblServices].[Services] WHERE [tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

Same missing operator error comes up.



Jeff said:
When you write an SQL statment, you refer to fields in tables/queries
with a dot (.) not a bang (!). So it should be
[tblServices].[Services]

Hope that helps!

I am trying to create a form with Linked Combo Boxes and have hit a
snag. On the second combo box in my query I have the following as the
Row Source:

SELECT [tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]

I want the form to show me all of the items in the Services table that
match the selected item from the Category table. I am receiving the
following error:

Syntax error (missing operator) in query expression
'[tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]'

Can anyone help me with this please!
 
J

Joan Wild

Is this the SQL statement of a query, or are you doing this in code?
The former
SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

The latter, assuming cboCategory is text
"SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] = " & chr(34) &
Forms![frmLinkedControls].[cboCategory] & chr(34)
all on one line

--
Joan Wild
Microsoft Access MVP
Thank you for the tip, unfortunately, that didn't work either.

SELECT [tblServices].[Services] WHERE [tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

Same missing operator error comes up.



Jeff said:
When you write an SQL statment, you refer to fields in tables/queries
with a dot (.) not a bang (!). So it should be
[tblServices].[Services]

Hope that helps!

I am trying to create a form with Linked Combo Boxes and have hit a
snag. On the second combo box in my query I have the following as
the Row Source:

SELECT [tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]

I want the form to show me all of the items in the Services table
that match the selected item from the Category table. I am
receiving the following error:

Syntax error (missing operator) in query expression
'[tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]'

Can anyone help me with this please!
 
P

Paula

Well, the error is gone but I am not getting any data. Back to the
drawing board. Thank you all for your help.


Joan said:
Is this the SQL statement of a query, or are you doing this in code?
The former
SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

The latter, assuming cboCategory is text
"SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] = " & chr(34) &
Forms![frmLinkedControls].[cboCategory] & chr(34)
all on one line

--
Joan Wild
Microsoft Access MVP
Thank you for the tip, unfortunately, that didn't work either.

SELECT [tblServices].[Services] WHERE [tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

Same missing operator error comes up.



Jeff said:
When you write an SQL statment, you refer to fields in tables/queries
with a dot (.) not a bang (!). So it should be
[tblServices].[Services]

Hope that helps!


Paula wrote:
I am trying to create a form with Linked Combo Boxes and have hit a
snag. On the second combo box in my query I have the following as
the Row Source:

SELECT [tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]

I want the form to show me all of the items in the Services table
that match the selected item from the Category table. I am
receiving the following error:

Syntax error (missing operator) in query expression
'[tblServices]![Services] WHERE [tblServices]![Services] =
Forms![frmLinkedControls]![cboCategory]'

Can anyone help me with this please!
 
J

John Vinson

Well, the error is gone but I am not getting any data. Back to the
drawing board. Thank you all for your help.


Joan said:
Is this the SQL statement of a query, or are you doing this in code?
The former
SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] =
Forms![frmLinkedControls].[cboCategory]

The latter, assuming cboCategory is text
"SELECT [tblServices].[Services] FROM tblServices WHERE
[tblServices].[Services] = " & chr(34) &
Forms![frmLinkedControls].[cboCategory] & chr(34)
all on one line

What's the Bound Column of cboCategory? And what's the datatype of
[Services]? If [Services] is a Lookup Field in your table, be aware
that it does NOT contain what you see, but rather a concealed ID
value... it may be that you're trying to match a text category to a
numeric ID or vice versa.

John W. Vinson[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