Solved

ODBC Query to MSAccess

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 198
delphi prevent click fast 2 215
Delphi inherited method 6 68
Delphi: making a BW image transparent 10 37
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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