473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

date problem

121 100+
Hi
i want to retieve all the records of a particular date where date is specifiedin mask edbox
i have writtencode lie this

rssearch.Open "select * from timesheet where date1= #" & mskfrom.Text & "#", con, adOpenDynamic, adLockOptimistic
but it does not work though the specified date is pesent in ms- access table
Jan 6 '08 #1
7 972
creative1
274 100+
Hi
i want to retieve all the records of a particular date where date is specifiedin mask edbox
i have writtencode lie this

rssearch.Open "select * from timesheet where date1= #" & mskfrom.Text & "#", con, adOpenDynamic, adLockOptimistic
but it does not work though the specified date is pesent in ms- access table
You need to format you date for access; May be in a variable and then pass in query
fromdate = Format$(mskfrom.Text , "m/dd/yy")
Jan 6 '08 #2
debasisdas
8,127 Expert 4TB
Try to use dtpicker instead of masked control, and format the date as per database format before passing to SQL string.
Jan 6 '08 #3
creative1
274 100+
Is this useful/effective to use datepicker for applications that are not allowed to use pointing devices?
Jan 6 '08 #4
daniel aristidou
491 256MB
"select * from timesheet where date1= #" & mskfrom.Text & "#" .
Why not try formating both dates like this,
"select * From timesheet where Format(Date1,'yyyymmdd') = " & Format(mskfrom.Text ,'yyyymmdd')
Jan 6 '08 #5
Killer42
8,435 Expert 8TB
... "select * From timesheet where Format(Date1,'yyyymmdd') = " & Format(mskfrom.Text ,'yyyymmdd')
Generally speaking, it's not a good idea to use a function in the WHERE clause. It may not matter if the database is small, but for a large one, no way!

You force the DBMS to read every record and format the value, just to decide whether to read the record. :(

Also, in this example I think you'd need single quotes around the test value.
Jan 7 '08 #6
Killer42
8,435 Expert 8TB
Something else to keep in mind. Is it actually a date value stored in the field, or a date and time?

Let's say the database record has 1/1/2007 13:53:28 in the field. If you search for 1/1/2007 I would not expect it to match.

In such a case you might have to consider options such as...
  • Use a range, such as Between #m/d/y 00:00:00# and #m/d/y 23:59:59#.
  • Use a function (yes yes, I know what I said...) to look at just the date, without the time.
Of these two, obviously you'd expect the range to be more efficient, based on what I mentioned above.
Jan 7 '08 #7
debasisdas
8,127 Expert 4TB
Is this useful/effective to use datepicker for applications that are not allowed to use pointing devices?
You mean to say want to use only textbox and buttons and nothing else ?
Jan 7 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
7
by: martini | last post by:
Need help: I am trying to call a DB2 stored procedure that requires parameters: 4x int, date, varchar, int. I use VB6 & oledb. I'm using statements: cmd.CommandText = "{call db2admin.proc(1, 0,...
11
by: David B | last post by:
I have 2 querys with the following in the date criteria Between DateAdd("m",-6,(!!)) And (!!) Between DateAdd("m",-24,(!!)) And DateAdd("m",-6,(!!)) Problem is they both look at the same...
3
by: Dustin Wilson | last post by:
I have a problem with the following line of code. rstOutput! = FormatDateTime("January 1, 2004", vbLongDate) When I run this on my computer at home it runs without problem but when I run it at...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
1
by: TN Bella | last post by:
Hello, I was looking through the older posts for a solution to this problem, but I am still confused on how to fix my problem. There are two dates on my form, one (txtInvDate) is entered by the...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
13
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.