If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Problem in Selecting time from Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-01-10, 16:41
Fawad0179 Fawad0179 is offline
Registered User
 
Join Date: Dec 2010
Posts: 3
Problem in Selecting time from Query

Hello,

I have a problem in selecting time from query my computer language is in Norwegian. I am using visual basic 6 with msaccess.

when I use Jan,Feb,Mar,Apr as month query gives me the correct resule but when I use May it gives me a error message. I thing it is because of language.
Because May = mai in Norwegian.

sql = "select distinct format(ms.match_Date_Time,'hh:mm:ss') from Season s,leauge l,Match_Schedule ms where s.Season_Id=ms.Season_Id and s.Season_Year=" & cmb_Season_Year.Text & " and l.leauge_Id=ms.Leauge_Id and l.Leauge_Name='" & cmb_Leauge_Name.Text & "' and format(ms.match_Date_Time,'dd.mm.yyyy')=#" & Format(cmb_Date.Text, "dd-mmm-yyyy") & "# and NOT EXISTS( SELECT schedule_Id FROM Match WHERE Schedule_Id = ms.Schedule_Id ) order by format(ms.match_Date_Time,'hh:mm:ss')"

can any one help me in this regard?

Regards,

Fawad Munir
Reply With Quote
  #2 (permalink)  
Old 12-01-10, 18:15
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
You have to use the US format. Otherwise you're comparing strings.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 12-02-10, 03:11
Fawad0179 Fawad0179 is offline
Registered User
 
Join Date: Dec 2010
Posts: 3
Can you give any example of that if possible?thanks.
Regards,
Fawad
Reply With Quote
  #4 (permalink)  
Old 12-02-10, 14:44
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
us date format is mm/dd/yyyy
alternatively you may get away with ISO date format YYYY/DD/MM
literal dates shouyld be encapsualted with a # symbol
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 12-03-10, 20:05
Fawad0179 Fawad0179 is offline
Registered User
 
Join Date: Dec 2010
Posts: 3
yes I am using us date format but when I set. the format mm/dd/yyyy in msaccess it show date like this in database dd.mm.yyyy and when I select that date using query, it gives me the sytax error in date format. If possible can you send me any example in which I can see whole process. I will be very thankful to you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On