?
Solved

parameter date in sql

Posted on 2003-02-24
8
Medium Priority
?
237 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
[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
  • 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
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.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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

777 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