Solved

URGENT! SQL Query no working!??

Posted on 2002-04-12
4
151 Views
Last Modified: 2010-05-02
Hi all,
I'm trying to retrieve the last set of records which were inserted into the
database. The records which are inserted include a TimeStart. This variable
is set to Now(). WHat i thought I could do is retrieve the records based on
this value, because the retrieval will be done straight after the update.
The SQL Query is:
datinfo.RecordSource = "SELECT * FROM Records WHERE (Records.TimeStart = "
&frmL0S1.TStart& ")"

Records.TimeStart is the field where the time is inserted.
frmL0S1.TimeStart stores this time, because this time was carried through a
number of forms before being inserted into the database.
Records.TimeStart is a text field
frmL0S1.TStart is declared as a date field.
I'm not sure if this would be a problem considering the update is working
fine.
I've tried placing single quotation marks around frmL0S1.TStart but that doesn't work
and also converted this to a string but that won't work either!
All help is greatly appreciated.

Thanks
C
0
Comment
Question by:Buca
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
drokliss earned 50 total points
ID: 6937887
One problem here is that your Records.TimeStart is a text field. If this is a field that stores a date, it should be declared as a datetime.

If you are trying to retrieve all records inserted after, say, 12 PM today, the WHERE would look like this:
"WHERE (Records.TimeStart >= '" & frmL0S1.TStart & "')"

But again, your field in the db needs to be a date field.
0
 

Expert Comment

by:drokliss
ID: 6937889
Oops, I forgot to mention that frmL0S1 in the example above would hold '4/12/02 12:00:00 PM' and should probably be a text field rather than a date field.
0
 

Author Comment

by:Buca
ID: 6937915
Thank you so much
much appreciated
0
 

Author Comment

by:Buca
ID: 6937917
Thank you so much
very much appreciated
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
add text to end of existing text in file 16 69
MS Acccess - Update Field in Table when report is printed 6 44
Add a task in Outlook from access 11 35
vb6 connector to mongodb 2 53
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

861 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

24 Experts available now in Live!

Get 1:1 Help Now