473,606 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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";"1 2/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
2 2060
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.1530 35$_M.725952@at tbi_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";"1 2/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";"1 2/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(for ms!YourForm!You rCombo!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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5747
by: monika | last post by:
hi ... I have an asp page which has 3 buttons. <p align="center"><input class="button" type="button" onClick="location='welStudent.asp';" value="Click to write a new story"></p> <p align="center"><input class="button" type="button" onClick="location='draftedStory.asp';" value="Click to complete the drafted story"></p> <p align="center"> <input class="button" type="submit" value="Click to view your grade sheet" name="submit"> </p>
4
1318
by: Bob | last post by:
Hallo, I have to make a web application in Javascript/ASP for tenniscourt reservation (based on Access database). I would like to do everything with one page, because the user must be able to change his day, hour or tenniscourt choice before really reserving it . I tried like this: The first SELECT contains the date (next 30 days) and is filled dynamically. No problem. When the date is chosen (by clicking), the second SELECT must...
7
6405
by: rickcheney | last post by:
I just changed my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was clicked a Report was opened. The reports record source is a query. The query uses the value from the form text box to restrict the query. Table name = EggsTable one of the columns in the table is named: EggColor Form name = EggColorForm Form text box name = ColorTextBox
0
1710
by: Omar K | last post by:
Hi, I am quite new to frontpage and SQL but I have a Stock Control access database / frontpage to set up. My last problem deals with the automatic updating of the total quantity of stock with parts move in or out of the warehouse. The following shows my page layout (i posted this on the frontpage group, but I think their level is too high for my skills, since i use the DRR most of the time) I have form.htm that asks the user for two...
2
17970
by: Chris | last post by:
I have two forms. From form one I have a listbox that when double clicked I get the selected value (string) and store in a variable. I parse the string to get the first 12 characters and store it in a variable to query a sql db. I set break points to see the data as it is passed from form1 and when calling the function from form2 to get the variable, its contents are blank. I believe what I'm looking for is some method to access an...
2
1321
by: Bob Sanderson | last post by:
I have a search form from which I hope to be able to select a record by field JobNumber and display it with an output form titled test.php <html> <head> <title>Job Database Search</title> </head> <body style='font-family: Geneva, Arial, Helvetica, sans-serif;'> Enter Job Number: <form action="test.php" method="post">
11
3757
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result = mysql_query("select * from $tableInfo") ; for ($i = 0; $i < mysql_num_rows($result); $i++) {
1
1816
by: rfr | last post by:
I have a need to use a single version of a Visitor Response Feedback Form on numerous HTML documents. Rather than have numerous versions of this, one on each HTML document, it makes more sense to have ONE FORM and use it from each HTML document that needs it. But, the visitor should see a title on the form that relates to the specific page about which they are giving the feedback. And the results of the form must include what page was...
5
5457
by: RacerX2000 | last post by:
I have an MS access Database (2000) and Have created a form that sets a variable to a value I would like (Based on other selections in the form) to pass to my query criteria and I get the following results. If the Form Variable = "10" - everything works fine If the Form Variable = "Between 10 And 12" - it tells me the criteria is too complex If I paste the exact text from the variable ie "Between 10 And 12" into the query it works fine ...
0
8031
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7962
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8107
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6792
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5971
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.