By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,671 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,671 IT Pros & Developers. It's quick & easy.

Please Help Passing Variable from Form to Query

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.