验证Access中的邮政编码?

编程入门 行业动态 更新时间:2024-10-20 06:31:29
本文介绍了验证Access中的邮政编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在寻找实现此目的的方法,但是我发现它很困难:(

I have been searching around for a way to do this but I am finding it hard :(

我对VBA非常陌生(实际上,我还没有使用过它),但我下定了决心!

I am very very very new to VBA (In fact, I have not used it) but I am determined !

我想做的是验证邮政编码,以便对其进行格式化并检查.我已经尝试了输入掩码和验证,但这并不完美.所以我转向了VBA.

What I want to do is validate a postcode so that it formats it and checks it. I have tried Input mask and validation, but this are not perfect. So I have turned to VBA.

我找到了代码示例,并将其放入VBA中,但我无能为力:(

I have found examples of code, and put them into VBA, but I can't get it to do anything :(

它需要使用这些邮政编码...

It needs to work with these postcodes ...

A9 9AA

A9A 9AA

A99 9AA

AA9 9AA

AA9A 9AA

AA99 9AA

如果有人可以帮助,那就太好了.但是如果有人可以给我一个包含验证器的数据库,那将是最好的,这样我就可以在实践中看到它并学习.但是任何事情都会好.只是如何使它工作将是一件好事:).我要做的是将代码此处粘贴并粘贴到模块中,希望最好,但是什么也没发生?

If anyone could help it would be great. But what would be best if someone could give me a database with the validator in, so I could see it in action and learn. But anything would be good. Just how to make it work would be good :) . What I have done is copy and pasted the code Here into a module and hoped for the best, but nothing happened ?

所以任何帮助都会很好.

So any help would be good.

谢谢

推荐答案

您可以使用将所有英国邮政编码下载到数据库的建议.但是,随着以后添加新代码,您将不得不紧随其后.我敢肯定有一个自动的免费服务可以为您做到这一点,但这对您来说是非常高级的编程.

You can use the suggestion of downloading all the UK Post Codes to your database. However, you'll have to stay on top of it as new codes are added later. I'm sure there's an automatic free service out there that will do this for you, but that would be very advanced programming for you.

如果您只想验证模式,我发现 此示例 .它不仅可以验证模式,还可以纠正常见的拼写错误.

If you want to just validate the pattern, I found this example. It will not only validate the pattern, but also correct for common typo errors.

如果您确实使用此代码,则仍必须在正确的时间调用它.可能是因为用户在输入代码后离开了文本框,或者是他们试图保存记录或移至另一条记录(自动保存).

If you do use this code, you'll still have to call it at the correct time. That could be when the user leaves the textbox after entering the code, or when they are trying to save the record, or move to another record (automatic save).

祝你好运

更多推荐

验证Access中的邮政编码?

本文发布于:2023-11-28 07:19:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641442.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮政编码   Access

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!