更改访问日期格式 [英] Changing the Access date format

查看:134
本文介绍了更改访问日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Access表单中,我需要使用从日期选择器字段输出的日期来搜索表单中的文件.但是,默认数据格式似乎仅允许斜杠.尽管我知道日期会以数字形式存储在数据库中.

In an Access form, I need to use the date output from a date picker field to be used to search for a file in a form. However, the default data format seems to only allow slashes. Although I know the date is being stored as a number in the database.

简单地说,我需要Me.myDate来输出合法的文件名结构,例如yy-mm-dd.然后,我可以将其与我的文件名连接起来以搜索myfilename_yy-mm-dd

Put simply, I need Me.myDate to output a legal file name structure, for example, yy-mm-dd. Then I can concatenate that with my file name to search for myfilename_yy-mm-dd

我总是得到myfilename_yy/mm/dd,它当然不能用作文件名.

I always get myfilename_yy/mm/dd which is of course unusable as a file name.

更改字段格式显然对值的存储方式没有影响.我不明白的是,如果日期以数字形式存储,并且输出以所选格式显示,那么如何覆盖查询日期时使用的默认格式设置行为.

Changing the format of the field obviously makes no difference to how the value is stored. What I don't understand is if the date is stored as a number, and the output is shown in the selected format, how I can override the default formatting behaviour used when I query the date.

推荐答案

The Format Function will allow you to format the date as you wish.

在文件名模式中包含格式化日期的表达式可能看起来像这样...

An expression to include the formatted date in a filename pattern could look like this ...

"myfilename_" & Format(Me.myDate, "yy-mm-dd") & "*"

这篇关于更改访问日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆