Solved

URGENT! SQL Query no working!??

Posted on 2002-04-12
4
157 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
[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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

726 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