Solved

ODBC Query to MSAccess

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Filemaker 14 vs Delphi Embarcadero 7 160
Firewall issues 6 85
Need Delphi function to get Youtube video title 5 187
select query - oracle 16 82
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

21 Experts available now in Live!

Get 1:1 Help Now