|
-
Sep 13th, 2000, 05:45 AM
#1
Thread Starter
Lively Member
Hi all
In South africa we use the date format dd/mm/yy
My regional settings are set to this format
My problem is that in my VB app the user must be able to search for soemthing by its date.
I have five records with the date #12/09/00#
When I search 12/09/00 it finds no records
I use SQL to do the search. (MS ACCESS 97)
What access seems to do is swop the date in the actual SQL query to 09/12/00 -- ie. mm/dd/yy
This is despite the fact that the records get saved in the dd/mm/yy format
anyone know why access does this or how I can get it to not swop the format??
the query part is
"where ((prEmergency.date) =#" & txtDate.Text & "#)
Thanks in advance
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
-
Sep 13th, 2000, 06:25 AM
#2
Lively Member
I hate dates to
The format() function will make it possible to format the date the way Access wants it to appear in the SQL statement.
I make apps for Europe and US and have to consider both date formats.
Yesterday, all my troubles seemed so far away...
Help, I need somebody, Help...
Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.
-
Sep 13th, 2000, 06:48 AM
#3
Junior Member
I have had the same frustrating problem. This function sorted it out. I use the same dateformat as you: dd/mm/yy.
Public Function AccDate(Date As Date) As String 'converter
AccDate = "#" & Month(Date) & "/" & Day(Date) & "/" & Year(Date) & "#"
End Function
Public Function GetWhatever() As String
Dim strSQL As String
strSQL = "SELECT this FROM that " _
& "WHERE (this.Date = " & AccDate(objTicket.GetDate) & ")"
Set primaryRS = New ADODB.Recordset
primaryRS.LockType = adLockOptimistic
primaryRS.CursorType = adOpenStatic
primaryRS.Open strSQL, dbConn
GetKapasitet = primaryRS.Fields!øohfewoijh
End Function
Hope you can sort something out from this.
If not, just mail me.
Lars
[Edited by mehlar on 09-13-2000 at 07:53 AM]
Lars Jarle Mæhlum
http://www.touch-it.no
-
Sep 13th, 2000, 07:19 AM
#4
Addicted Member
Hi,
I have a question for you, are you using an ODBC connection or do you use JET ?
-
Sep 13th, 2000, 08:28 AM
#5
Junior Member
Lars Jarle Mæhlum
http://www.touch-it.no
-
Sep 13th, 2000, 08:38 AM
#6
Addicted Member
Do a test :
do the same thing with a JET Connection. I've experienced some problems with ODBC connections relating to date formats. See if the date gets mixed in JET ( no ). ODBC is quite fussy on dates...
-
Sep 13th, 2000, 12:58 PM
#7
Thread Starter
Lively Member
I am using Jet and am having the problem. But also had the problem with ODBC.
Thanks for mehlar...I will try it out
You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|