Solved

URGENT! SQL Query no working!??

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

706 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

12 Experts available now in Live!

Get 1:1 Help Now