Using Combo Box on Form with Sql view to filter

E

Eric

I have recently convert my Access 2003 Database to Sql Server using
the upsizing wizard. One query that didn't transfer was filtering
records based on a combo box selection on a form. I have tried several
things and can't get this to work in a Sql view query. What I want is
to filter records in a Sql view based on a combo box on a form. What
is the correct way to do this? Any help is appreciated
 
E

Eric

HEre is a example of what is not working in my query
FROM dbo.HOURADD
WHERE CVGLOCATION = Forms!Switchboard!CVGLOCATION1
ORDER BY NAMEI get a error is where clause near !
 
E

Eric

Here is a example of what is not working in my query
FROM dbo.HOURADD
WHERE CVGLOCATION = Forms!Switchboard!CVGLOCATION1
ORDER BY NAME

I get a error is where clause near !
 
J

John W. Vinson

HEre is a example of what is not working in my query
FROM dbo.HOURADD
WHERE CVGLOCATION = Forms!Switchboard!CVGLOCATION1
ORDER BY NAMEI get a error is where clause near !

What's the context, Eric? Your query as posted doesn't have a SELECT clause,
which would be required; and the forms reference would work in an Access
frontend (so long as the form is open), but would not work if you're running
the query in a SQL/Server instance.

Note that NAME is a reserved word and probably should not be used as a
fieldname.
 
E

Eric

Basiclly without getting to specifics. I am running in sql/server
instance. I have a form that has a combo box. I want to filter the sql
view base on the vaule in the combo box. How can this be done? I just
need soemone to point me in the right direction so I can research.

In microsoft access I would create a query and refence a Forms!
FORMNAME!CboBox then my query would be filtered. How can I do the same
with Sql Views in Acccess?
 
J

John W. Vinson

How can I do the same
with Sql Views in Acccess?

AFAIK only by extracting the value from the forms control in VBA code and
constructing a valid T-SQL string, and using it as a Passthrough Query. SQL
has no way to view the contents of an Access form.
 

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