|
-
Nov 11th, 2000, 10:23 AM
#1
Thread Starter
Junior Member
Hi there,
I am facing a problem while using Visual Basic version 6, Service Pack 3.
My database is in MS Access and when I try to store date in the date field
of the database, I get the the conversion problem while diplaying date in
the Mask Edit field on the form; date displays in the format that
is set in the regional settings of the Windows Control Panel. Can you help
me in displaying the date field irrespective of the regional settings
in dd/mm/yyyy format?
-
Nov 11th, 2000, 10:57 AM
#2
Monday Morning Lunatic
Why not set the Regional Settings up properly? The idea of displaying the date is that it is in the local format.
In Access, I think there's a way to change the date format, will clarify in a few moments...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 12th, 2000, 11:19 AM
#3
Well ...
I had exactly the same problem when I tried to replace all textboxes on my form with the Masked Edit box. Actually you can try a number of ways here:
1. Retrieve the date from the Access database, use the VB Format() function to format it into 'dd/mm/yyyy' and show it.
2. Retrieve the date from the Access database in such a way that it is already formatted in 'dd/mm/yyyy' format, using SQL date conversion functions (of which, sadly I am not an expert.)
There is a third solution of using the Mask property of the editbox control, but I am not too sure whether it supports dd/mm/yyyy. If it does, you can assign the date value to the box, and then set the Mask property. Or if you have already set the Mask property, use a temporary variable and write the code as follows:
Code:
Dim tmpMask As String
Dim dbDate As Date
' Open recordset etc. etc.
' Fetch the date value into the dbDate variable
tmpMask = MaskEditBox1.Mask
MaskEditBox1.Mask = ""
MaskEditBox1.Text = dbDate
MaskEditBox1.Mask = tmpMask
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
|