473,287 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

2 Questions. ASP & SQL

Hi All,

Can anyone help.

Q1. How do I send 2 dates to a stored query in access. What I have in the
query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and #3/31/04#

What I want is to send to variables to this query that the user inputs.

Q2. I know that this is probably not the right group but I am trying to
trim a string (first name to 1 letter) in an SQL statement.

Does any one know how to do this? I do not want to use ASP as I will be
build a complete CSV file on the file (column names and data)

I appreicate any help on these matters.

Regards,

Stuart
Jul 19 '05 #1
2 1171
"Stuart" wrote ...
Q1. How do I send 2 dates to a stored query in access. What I have in the query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and #3/31/04#

I'm guessing you already have your sql statement in a string....
strDateOne = "03/01/04"
strDateTwo = "03/31/04"

SQL = "Select * from tblOrders where Date_Archived between #" & strDateOne &
"# and #" & strDateTwo & "#"

You'd obviously want to validate the date entries before doing this...
Q2. I know that this is probably not the right group but I am trying to
trim a string (first name to 1 letter) in an SQL statement.
You mean the results after the query has been executed or actually in the
sql statement?

If the former then...

strInitial = RS("Forename") ' guessing your field names
strInitial = Left(strInitial, 1)
Does any one know how to do this? I do not want to use ASP as I will be
build a complete CSV file on the file (column names and data)


Aha! You want the latter...

SQL = "SELECT Left(Forename, 1) AS Initial FROM your_table"

Hope this helps...

Regards

Rob
Jul 19 '05 #2
Stuart wrote:
Hi All,

Can anyone help.

Q1. How do I send 2 dates to a stored query in access. What I have
in the query so far is

Select * from tblOrders where Date_Archived between #3/01/04# and
#3/31/04#

What I want is to send to variables to this query that the user
inputs.
Great! I am happy to see you are not contemplating using dynamic sql. It is
much more efficient to use a saved query.
The first step is to parameterize this query. Change the sql statement to:

Select <column list> from tblOrders where Date_Archived between [pStart] and
[pEnd]

Save the query as qGetOldOrders. When you test it (what? you weren't
planning to test this in Access? shame :-) - one of the benefits of using
saved queries is that you get to test them in Access before trying to run
them in ASP), you will find that Access will prompt you for values for the
parameters. You will supply those values in your vbscript code.

Note: do not use selstar (select *) in production code: by being lazy, you
make the query engine work harder which is not good if you want an efficient
application

Now, in asp, do this
'create and open a connection called cn, then
set rs=createobject("adodb.recordset")
cn.qGetOldOrders #2004/03/01#,#2004/03/31#,rs

Your recordset will now be open.

Q2. I know that this is probably not the right group but I am trying
to trim a string (first name to 1 letter) in an SQL statement.


Unrelated questions should be split into separate posts. I'll make an
exception this time and answer it. In the future, please follow the
guideline of one question per post.

You can use the VBA Left() function in a Jet SQL statement:

Select Left(column_name,1), etc.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stefano | last post by:
I would like to get the value of a tag in an xml file, the problem is that, his structure is not <item>value</item> but is: <Cube> - <Cube time="somevalue"> <Cube rate="the value i want to get"...
13
by: Randy Webb | last post by:
Just for my own curiosity, what ever happend to the Java Applet that was referenced in the FAQ along with the HTTPRequestObject? http://jibbering.com/faq/#FAQ4_34 And in...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
6
by: John Wells | last post by:
Guys, My boss has been keeping himself busy reading MySQL marketing pubs, and came at me with a few questions this morning regarding PostgreSQL features (we're currently moving to PostgreSQL). ...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
1
by: robertmeyer1 | last post by:
Hi, I have 3 tables set up. tblQuestion, tblAnswer, tblClient. I have them linked together and have a sbf and mainform set up for data entry. The sbf links the questions and answers together. ...
5
by: Lloyd Sheen | last post by:
I have a couple of questions about URLs. I have an app which will allow me to access my music collection if I can access the internet. It shows a list of Artists / Genres / Search etc which...
7
by: tempest | last post by:
Hi all. This is a rather long posting but I have some questions concerning the usage of character entities in XML documents and PCI security compliance. The company I work for is using a...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.