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

x
?
Solved

select and dates?

Posted on 2000-04-17
8
Medium Priority
?
139 Views
Last Modified: 2010-05-02
I have text box on my form
in the text box property I have format to date
when i do my select to query access database it doesn't find the record???
let say textdate.text is my textbox

do i do
select * from mydatabase where datefield=textdate.text


or do i have to do a cdate on that textbox?

the field in my access database is same as the format in my textbox

any ideas???
0
Comment
Question by:jerbell
[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
  • 2
  • +2
8 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 60 total points
ID: 2723221
Date values must be enclosed within # signs.

ie.
Select * from mydatabase where datefield = #textdate.text#

Hope this helps.

0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2723245
Date values must be enclosed within # signs.

ie.
Select * from mydatabase where datefield = #textdate.text#

Hope this helps.

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2723255
The best way is to use the US format:

strsql = "select * from mydatabase where datefield = " & format(textdate.text, "mm/dd/yyyy")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:detiege
ID: 2723264
I prefer doing:

SELECT * FROM Table WHERE Datafield LIKE textdate.text



Try to put your query in a buffer and execute it:

Buff = "SELECT * FROM Table WHERE DateField LIKE '" & textdate.text & "'"

conn.Execute(Buff)

But be sure that your "DateField" and your "textdate.text" are in the same format ! ! ! ! !

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2723330
detiege,

You are new here! There is a rule that says not to post as an answer when other experts already began to answer. You don't have to lock question. The asker can always accept one of the comment as it's accepted answer because the asker has a button for it!

Also, you don't have to ensure the format when you send the date in the US format!
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2725174
emoreau:

I wholeheartedly agree that specifying the date format is the way to go. As I live and work in the USA, the mm/dd/yyyy format is no problem for me.

However, here at EE I have read several comments from people working in other nonUS locales that maintain the date default is dd/mm/yyyy. All in all.. dates still get me confused <blush>.. are you certain that mm/dd/yyyy is always the default date format regardless of locale? (I tend to believe it can be overridden through system settings.. but of that I am not sure).
0
 
LVL 1

Expert Comment

by:detiege
ID: 2725676
Excuse me to lock the question !

It's just that i'm new.

0
 

Author Comment

by:jerbell
ID: 2726416
thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
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…
Suggested Courses

610 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