Solved

URGENT! SQL Query no working!??

Posted on 2002-04-12
4
153 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 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