Solved

ODBC Query to MSAccess

Posted on 1998-10-14
3
317 Views
Last Modified: 2010-04-06
Hi there,

I stuck with this problem,

Im using ODBC to extract data from MSAccess Tables.

All works fine when querying for all data from the table:
        SELECT * FROM Person

But I want to be able to extract only the records with its DOB field within the current month.

Ive used the "SELECT * FROM PERSON WHERE EXTRACT(MONTH FROM DOB) = variable month" statement on Paradox tables and it works fine
Is there an equivelent statement to use in querying MSAccess Tables to only retreive record that are relevant to the current or selected month.

Thankyou
James  
0
Comment
Question by:hulsej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 1342932
hi  hulsej,

the sql statement:

select * from PERSON where month(DOB) = MonatVar

I Think DOB is a Datefield
Manotvar is IntegerTyp holds 1 to 12

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1342933
hi hulsej,

my answer is just not complete
the delphicode should be:

query1.close;
query1.clear;
query1.sql.add('select * from PERSON where month(DOB) = '+IntToStr(MonatVar);
try
  query1.open;
except
  {errorhandling}
end;

try it

meikl
0
 

Author Comment

by:hulsej
ID: 1342934
Thankyou this statement worked prefectly.

I want to incorperate the days as well. (what im trying to do is assess whether it is someones birthday with in the next three days)

Ive tried a few different approaches with no succsess (this is my first crack at SQL stuff).

what do I need to do in order to query on the month and the next three days in the one statement.

Thanks again

Later
Jay


0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question