Query problem

S

Shell

I have written a query to use a hidden field on a form. The field in the
form is taken from a list box. The field in the table is a long integer.
But hidden field is a text.


Therefore in the query criteria when I use

[Forms]![frmCRT]!([txtX])

I get no hits.

How do make this reference to the form field a long integer?

Thanks
 
S

Shell

This suggestion does not work. I get an error message
"This expression is typed incorrectly, or it is too complex to be evaluated.
For example, a numeric expression may contain too many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."

In the case I am attempting, the value of the hidden field = 153
--
Shell


RonaldoOneNil said:
Val([Forms]![frmCRT]![txtX])

Shell said:
I have written a query to use a hidden field on a form. The field in the
form is taken from a list box. The field in the table is a long integer.
But hidden field is a text.


Therefore in the query criteria when I use

[Forms]![frmCRT]!([txtX])

I get no hits.

How do make this reference to the form field a long integer?

Thanks
 
R

RonaldoOneNil

Does the query run if you hard code 153 as the criteria ?

I have just set up a similar situation to test and mine works with
[Forms]![TestForm]![txtX] or Val([Forms]![TestForm]![txtX])

Why have you got curly brackets around your [txtX] ?

Shell said:
This suggestion does not work. I get an error message
"This expression is typed incorrectly, or it is too complex to be evaluated.
For example, a numeric expression may contain too many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."

In the case I am attempting, the value of the hidden field = 153
--
Shell


RonaldoOneNil said:
Val([Forms]![frmCRT]![txtX])

Shell said:
I have written a query to use a hidden field on a form. The field in the
form is taken from a list box. The field in the table is a long integer.
But hidden field is a text.


Therefore in the query criteria when I use

[Forms]![frmCRT]!([txtX])

I get no hits.

How do make this reference to the form field a long integer?

Thanks
 
S

Shell

I do not have curly brackets. I have square brackets.

The query does run currectly if I hardoce the 153 in the criteria.

One more thing.

If I bring up the form and select from the listbox the row with any X in it.
The the value is transferred via code to the hidden text box. AT this point
the query with the reference works correctly. However, when I continue
processing (lots of code via a command button), whether I pause the code or
let the code continue to completion, the query does not run properly. The
query runs thru a "DoCmd.OpenQuery " experession. But I can run the query
directly from the Query page and it doesn't work.
--
Shell


RonaldoOneNil said:
Does the query run if you hard code 153 as the criteria ?

I have just set up a similar situation to test and mine works with
[Forms]![TestForm]![txtX] or Val([Forms]![TestForm]![txtX])

Why have you got curly brackets around your [txtX] ?

Shell said:
This suggestion does not work. I get an error message
"This expression is typed incorrectly, or it is too complex to be evaluated.
For example, a numeric expression may contain too many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."

In the case I am attempting, the value of the hidden field = 153
--
Shell


RonaldoOneNil said:
Val([Forms]![frmCRT]![txtX])

:

I have written a query to use a hidden field on a form. The field in the
form is taken from a list box. The field in the table is a long integer.
But hidden field is a text.


Therefore in the query criteria when I use

[Forms]![frmCRT]!([txtX])

I get no hits.

How do make this reference to the form field a long integer?

Thanks
 

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