467,130 Members | 1,263 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,130 developers. It's quick & easy.

Please Help Passing Variable from Form to Query

MX1
HELP!

I have a query that gets a few values from a form. The problem I'm having
is a date field in the query. When I put the value in the criteria, it
works fine. When I put the same value as an item in a combo box of the form
and try to pass the value, I get "This expression is typed incorrectly or
too complicated to be evaluated".

Here it is:

'6/30/' & Str(Year(Now()))

The options in the row source of the combo box are as follows:

"January";"'6/30/' & str(year(now)))";"July";"12/31/' & str(year(now)))"

Is my formatting incorrect? I get the same thing when trying to pass "0 or
1" to denote both yes and no values of a checkbox. It doesn't like the word
OR. Any thoughts would be GREATLY appreciated as always. Thanks!
Nov 12 '05 #1
  • viewed: 1793
Share:
2 Replies
You'll have to be more explicit about how you are "passing the value" from
the combo for anyone to provide useful suggestions. For what purpose are you
using the query? If it is as to select records for display in a form or
report, perhaps there's a better way to handle it.

Larry Linson
Microsoft Access MVP

"MX1" <mx*@mx1.abc> wrote in message
news:6XHEb.153035$_M.725952@attbi_s54...
HELP!

I have a query that gets a few values from a form. The problem I'm having
is a date field in the query. When I put the value in the criteria, it
works fine. When I put the same value as an item in a combo box of the form and try to pass the value, I get "This expression is typed incorrectly or
too complicated to be evaluated".

Here it is:

'6/30/' & Str(Year(Now()))

The options in the row source of the combo box are as follows:

"January";"'6/30/' & str(year(now)))";"July";"12/31/' & str(year(now)))"

Is my formatting incorrect? I get the same thing when trying to pass "0 or 1" to denote both yes and no values of a checkbox. It doesn't like the word OR. Any thoughts would be GREATLY appreciated as always. Thanks!

Nov 12 '05 #2
Hi,

On Fri, 19 Dec 2003 19:02:26 GMT, MX1 wrote:
I have a query that gets a few values from a form. The problem I'm having
is a date field in the query. When I put the value in the criteria, it
works fine. When I put the same value as an item in a combo box of the form
and try to pass the value, I get "This expression is typed incorrectly or
too complicated to be evaluated".

Here it is:

'6/30/' & Str(Year(Now()))

The options in the row source of the combo box are as follows:

"January";"'6/30/' & str(year(now)))";"July";"12/31/' & str(year(now)))"

Is my formatting incorrect? I get the same thing when trying to pass "0 or
1" to denote both yes and no values of a checkbox. It doesn't like the word
OR. Any thoughts would be GREATLY appreciated as always. Thanks!


two things: when working with dates, assure they're converted right. When
using expressions that are being "pulled" from a query, use the
eval-function around your expression there.
I.e. in your query, it should work with your value-list like this:

SELECT eval("cdate(forms!YourForm!YourCombo!column(1))") AS something, ...

The above will require a valid date though - you'll either have to assure
that from the form (which it would be with the string you create) or from
within the query with i.e. nz (slowing down the process).

Cheers,
Olaf [MVP]
--
My .02: www.Resources.IntuiDev.com
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bob | last post: by
2 posts views Thread by Bob Sanderson | last post: by
11 posts views Thread by kennthompson@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.