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

parameters sql statement

P: n/a
Hola !

I have a query where a parameter is required to get a result. Because
this is part of a procedure he should get the data automatically from
a selection of a drop down box. For reason of test I use a simple
textbox. However writing this, this is not working. What is the
correct syntax or is there another way. I used [] for the parameters
also and I tried an alias like AS test.

Expand|Select|Wrap|Line Numbers
  1. PARAMETERS Forms!Formulier1!txtYear Text ( 255 );
  2. SELECT ...
  3. FROM ...
  4. WHERE (((T_03_TIME.DAG) Between DateSerial(Forms!Formulier1!
  5. txtJaar-1,3,1) And DateSerial(Forms!Formulier1!txtJaar,2+1,0)));
Aug 8 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You have declare a parameter as Text, but than tried to perform math on it.
That's not going to work reliably.

Since the parameter seems to be the value for a year, try declaring it as an
Integer.

If you still have problems, get Access to write the query for your. Create
it in query design. Declare the parameter by choosing Parameters on the
Query menu. After testing that it works, switch the query to SQL View (View
menu), and there's your solution.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<pa***************@gmail.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
Hola !

I have a query where a parameter is required to get a result. Because
this is part of a procedure he should get the data automatically from
a selection of a drop down box. For reason of test I use a simple
textbox. However writing this, this is not working. What is the
correct syntax or is there another way. I used [] for the parameters
also and I tried an alias like AS test.

Expand|Select|Wrap|Line Numbers
  1. PARAMETERS Forms!Formulier1!txtYear Text ( 255 );
  2. SELECT ...
  3. FROM ...
  4. WHERE (((T_03_TIME.DAG) Between DateSerial(Forms!Formulier1!
  5. txtJaar-1,3,1) And DateSerial(Forms!Formulier1!txtJaar,2+1,0)));
Aug 8 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.