There is a problem in VBA text box while filling input mask property:
填充输入掩码属性时VBA文本框中存在问题:
I am trying to make the combination of date and time:
我想把日期和时间结合起来:
Hence i put it like below:
因此我把它说如下:
00/00/00;0;_00:00;0;_
But while running the application, i am only getting 00/00/00 (Date).
但在运行应用程序时,我只收到00/00/00(日期)。
But i remember, i got the result as like 00/00/00 00.00 as expected when i first put the expression as like above;
但我记得,当我第一次把表达式如上所述时,我得到的结果就像预期的那样00/00/00 00.00;
but now i am not getting it :-(
但现在我没有得到它:-(
2 个解决方案
#1
The InputMask property can contain up to three sections separated by semicolons (;)
InputMask属性最多可包含由分号(;)分隔的三个部分
Your mask should be like this:
你的面具应该是这样的:
"00/00/00 00:00;0;0"
or
"00/00/00 00:00;0;_" // to display it like __/__/__ __:__
#2
Why not just use the built in "General Date" format? I've found over the years that input masks are very restricting and basically a pain. Although it's been so long since I've used them that I don't recall the details of why I despise them.
为什么不使用内置的“通用日期”格式?多年来我发现输入面具非常有限,基本上是一种痛苦。虽然我使用它已经很久了,但我不记得为什么我鄙视它们的细节。
This also has the benefit of respecting the users choices of regional date format. For example I always use yyyy-mm-dd format.
这也有利于尊重用户对区域日期格式的选择。例如,我总是使用yyyy-mm-dd格式。
Also a client had a situation where the date format was decreed to be Medium Date on all fields. Which is dd-mmm-yy. It later turned out that in a table of 100K records there were twelve dates before 1900. They had simple had something extra keyed in in the year so Windows/Access interpreted those dates as being in the 3rd or 5th century or whatever. Now these dates weren't used in any kind of calculation so it wasn't a big deal. SQL Server upsizing to small date/time fields didn't appreciate those though.
此外,客户端的日期格式在所有字段上都被定为中日期。这是dd-mmm-yy。后来证明,在100K记录的表格中,在1900年之前有十二个日期。他们很简单,在一年中有一些额外的键入,因此Windows / Access将这些日期解释为在3或5世纪或其他任何日期。现在这些日期没有用于任何类型的计算,所以这并不是什么大问题。 SQL Server升迁到小日期/时间字段并不欣赏那些。
#1
The InputMask property can contain up to three sections separated by semicolons (;)
InputMask属性最多可包含由分号(;)分隔的三个部分
Your mask should be like this:
你的面具应该是这样的:
"00/00/00 00:00;0;0"
or
"00/00/00 00:00;0;_" // to display it like __/__/__ __:__
#2
Why not just use the built in "General Date" format? I've found over the years that input masks are very restricting and basically a pain. Although it's been so long since I've used them that I don't recall the details of why I despise them.
为什么不使用内置的“通用日期”格式?多年来我发现输入面具非常有限,基本上是一种痛苦。虽然我使用它已经很久了,但我不记得为什么我鄙视它们的细节。
This also has the benefit of respecting the users choices of regional date format. For example I always use yyyy-mm-dd format.
这也有利于尊重用户对区域日期格式的选择。例如,我总是使用yyyy-mm-dd格式。
Also a client had a situation where the date format was decreed to be Medium Date on all fields. Which is dd-mmm-yy. It later turned out that in a table of 100K records there were twelve dates before 1900. They had simple had something extra keyed in in the year so Windows/Access interpreted those dates as being in the 3rd or 5th century or whatever. Now these dates weren't used in any kind of calculation so it wasn't a big deal. SQL Server upsizing to small date/time fields didn't appreciate those though.
此外,客户端的日期格式在所有字段上都被定为中日期。这是dd-mmm-yy。后来证明,在100K记录的表格中,在1900年之前有十二个日期。他们很简单,在一年中有一些额外的键入,因此Windows / Access将这些日期解释为在3或5世纪或其他任何日期。现在这些日期没有用于任何类型的计算,所以这并不是什么大问题。 SQL Server升迁到小日期/时间字段并不欣赏那些。