[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get DatePicker to use only Short Date format (No Time)

Posted on 2008-11-13
7
Medium Priority
?
218 Views
Last Modified: 2013-11-27
Hello,

I have a form that runs a query for a specified date span. I'm using the datepickers to select the dates but they are "inserting" a timestamp as well. The formatting in my table is short date (1/1/2008) is there a way to format this so that I only get date values out of the date picker?

Thanks!
0
Comment
Question by:c9k9h
  • 4
  • 3
7 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 22953589
could you not change your query to format the date in your date span?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 22953611
or failing that, when you read the date from the datepicker, format it then?
0
 

Author Comment

by:c9k9h
ID: 22953736
Hmmm. Format it in the query? it's straight SQL and looks like this:

sSQL = ""
sSQL = sSQL & "SELECT Sum(GoalPC) AS PC "
sSQL = sSQL & "FROM Goals "
sSQL = sSQL & "WHERE Custodian = '" & Me.cboCustodian & "' And WeekOf Between #" & DFrom & "# And #" & DTo & "#"
Set rsActivity = CurrentDb.OpenRecordset(sSQL)
Me.k7 = rsActivity!PC

what is happening is, it's not including the start date in the query. For instance, if i have records on 10/6/08 i can't set the date picker to that date, it has to be the date before 10/5/08 to capture that data... Perhaps there is something else I could use besides "Between"?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:c9k9h
ID: 22953750
And if i use regular text boxes to input the date it works fine... so it must not be the "Between" statement.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 22954153
What about

Between #" & format(dfrom,"short date") & "# and #" & format(dTo,"short date") & "#"

0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 22954172
another one I use, long winded but dunno I seem to prefer this way


sSQL = sSQL & "WHERE Custodian = '" & Me.cboCustodian & "' And format(WeekOf Between,'YYYYMMDD') >= " & format(DFrom,"YYYYMMDD") & " And format(WeekOf Between,'YYYYMMDD') <= " & format(dTo,"YYYMMDD")
0
 

Author Closing Comment

by:c9k9h
ID: 31516514
Perfect, thank you!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

873 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