Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ODBC Query to MSAccess

Posted on 1998-10-14
3
Medium Priority
?
320 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 400 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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 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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

604 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