Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

parameter date in sql

Posted on 2003-02-24
8
Medium Priority
?
238 Views
Last Modified: 2012-05-04
hello
hope can reply me about this
i have Calendar and click on it to put the date in  2 textbox and then click button to get the data between this 2 date for example "10-january-03" and "10-march-03"
the problme my sql parameter accept only numbers??
and another thing it execute "month-day-year"
not "day-month-year"????
please tell me how can use date like"10-january-03"
in the parameter

Private Sub Command4_Click()
rec2.Open "select * from entry " & _
" where d Between #" & Text2 & "# And #" & Text3 & "#", cnn, , , adCmdText

greatfull for any reply
0
Comment
Question by:egkid
  • 5
  • 2
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8010277
is the field called d in fact a Date/Time field in the database (I assume here that you are using Access as the back-end database???)

AW
0
 

Author Comment

by:egkid
ID: 8010330
hi
yep the date field in table name d

any suggestion??
0
 
LVL 1

Accepted Solution

by:
dwphilippe earned 80 total points
ID: 8010595
You can use the format function.

rec2.open "select * from entry " & _
"where d between cDate(" & format(text2.text,"DD-MM-YYYY") & ") and cDate(" & format(text2.text,"DD-MM-YYYY") & ")"

pdw
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.

 

Author Comment

by:egkid
ID: 8010641
hello dwphilippe
thanks for reply
i did as u said

rec2.Open "select * from entry " & _
"where d between cDate(" & Format(Text2.Text, "DD-MM-YYYY") & ") and cDate(" & Format(Text3.Text, "DD-MM-YYYY") & ")", cnn, , , adCmdText

the report the empty hmmmmm
did i forget something?
0
 

Author Comment

by:egkid
ID: 8010678
hmmm
i checked the table it have dates but report came empty
grrrrrrr
help please
0
 

Author Comment

by:egkid
ID: 8011816
hello dwphilipp
guess what
u r statment missed something that why report came empty
missing #
is it possible to change Calendar language?

thanks so much dwphilipp

0
 

Author Comment

by:egkid
ID: 8011851
here it is A:EXCELLENT
thanks again
please let me know if possible change Calendar language
0
 
LVL 1

Expert Comment

by:dwphilippe
ID: 8016120
For this you must create your on date with a two dimention array. The first dimention for the month and the second for the language.

dim strMonth(1 to 12, 1 to 3) as string
strMonth(1, 1) = "Januari"
strMonth(1, 2) = "Janvier"
strMonth(1, 3) = "January"
...

msgbox day(text2.text) & " " & strMonth(month(text2.text), language) & " " & year(text2.text)

pdw
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

578 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