Solved

ODBC Query to MSAccess

Posted on 1998-10-14
3
311 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Filemaker 14 vs Delphi Embarcadero 7 186
Newbie Thread Programming 1 139
Tembedded WB animatid gifs not animated on some pcs 2 73
Firemonkey webbrowser scrollbars ? 1 29
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now