Help with a select statement

  • Thread starter Thread starter Darryl
  • Start date Start date
D

Darryl

Greetings,
I have created a report. I have also created a form that is called to get
the report
criteria.

Here is the select statement:
SELECT [NewClientCaseMasterTable.ClientCity] AS Expr1,
[NewClientCaseMasterTable.ClientState] AS Expr2,
[NewClientCaseMasterTable.LastName] AS Expr3,
[NewClientCaseMasterTable.FirstName] AS Expr4
FROM NewClientCaseMasterTable
WHERE (([NewClientCaseMasterTable.ClientCity])=([ Form]!City_popup!Clist))
ORDER BY [NewClientCaseMasterTable.ClientCity];

You can see where I try to reference the selection from the listbox on form
city_popup.
The listbox is named clist.

How do you access this value correctly ?

thanks.
 
Darryl said:
Greetings,
I have created a report. I have also created a form that is called
to get the report
criteria.

Here is the select statement:
SELECT [NewClientCaseMasterTable.ClientCity] AS Expr1,
[NewClientCaseMasterTable.ClientState] AS Expr2,
[NewClientCaseMasterTable.LastName] AS Expr3,
[NewClientCaseMasterTable.FirstName] AS Expr4
FROM NewClientCaseMasterTable
WHERE (([NewClientCaseMasterTable.ClientCity])=([
Form]!City_popup!Clist)) ORDER BY
[NewClientCaseMasterTable.ClientCity];

You can see where I try to reference the selection from the listbox
on form city_popup.
The listbox is named clist.

How do you access this value correctly ?

thanks.

[Forms]![City_popup]![Clist]

Of course, the form must be open at the time the query is executed.
 
Will [Forms]![City_popup]![Clist] give the currently selected item in the
listbox ?

ie

where (([NewClientCaseMasterTable.ClientCity]) = ([Forms]!City_popup!Clist))

It automatically removes the [] when I save the select.

Goal is to have a form pop with a list box that has a query souce.
When the user selects and item from the list box, he presses the ok button.
the report then runs with the report's select statement modified to reflect
the choice in the list box.

I have followed the online help to setup a form to feed the report, only
when
I open the report, the form shows. I select the listbox item I want then
press OK.

I get the following informational message:
The expression you entered has a function name that Microsoft Access can't
find.

Any help would be appreciated.



Dirk Goldgar said:
Darryl said:
Greetings,
I have created a report. I have also created a form that is called
to get the report
criteria.

Here is the select statement:
SELECT [NewClientCaseMasterTable.ClientCity] AS Expr1,
[NewClientCaseMasterTable.ClientState] AS Expr2,
[NewClientCaseMasterTable.LastName] AS Expr3,
[NewClientCaseMasterTable.FirstName] AS Expr4
FROM NewClientCaseMasterTable
WHERE (([NewClientCaseMasterTable.ClientCity])=([
Form]!City_popup!Clist)) ORDER BY
[NewClientCaseMasterTable.ClientCity];

You can see where I try to reference the selection from the listbox
on form city_popup.
The listbox is named clist.

How do you access this value correctly ?

thanks.

[Forms]![City_popup]![Clist]

Of course, the form must be open at the time the query is executed.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Darryl said:
Will [Forms]![City_popup]![Clist] give the currently selected item
in the listbox ?

ie

where (([NewClientCaseMasterTable.ClientCity]) =
([Forms]!City_popup!Clist))

It automatically removes the [] when I save the select.

Goal is to have a form pop with a list box that has a query souce.
When the user selects and item from the list box, he presses the ok
button. the report then runs with the report's select statement
modified to reflect the choice in the list box.

I have followed the online help to setup a form to feed the report,
only when
I open the report, the form shows. I select the listbox item I want
then press OK.

I get the following informational message:
The expression you entered has a function name that Microsoft
Access can't find.

Any help would be appreciated.

First, verify that you have the correct name for the form and the list
box control on that form. If those are both correct, find out if you
can open the query itself directly (with the form also open and a list
box selected.

Please post all the code you have for the form module, and the code that
is in the report's Open event.
 
BTW, the correct reference to Table Field should be like:

[NewClientCaseMasterTable].[ClientCity]

(note the extra square brackets).
 
Back
Top