开发者

Default value in data table design

I'm designing a data table in Access. I have two columns whose values are something like:

col1: CU001-

col2: 03

and i want to join these two string to form another column's default value like: CU001-03 How can i do this?

And one more question is whether using a string开发者_运维百科 as main key tends to be much slower than a numeric?


I’m fairly sure (but open to correction) that you cant have this kind of thing in access using the default value however you can get the same effect by doing something like this.

If you have an unbound form then you can set the value of your 3rd column before you save it like this presto code

With rst
    !YourCol1=”foo”
    !YourCol2=”bar”
    !YourCol3= !YourCol1 & !YourCol2
    .Update
End with

Search on “unbound forms” on google to see full examples of unbound forms, also if you are only using JET to store your data then use DAO over ADO as it will be faster

EDIT

I have not read any books specifically on access but I can strongly recommend a few access websites that have helped me. Here they are in no particular order

http://www.mvps.org/access/ http://www.granite.ab.ca/access/ http://www.lebans.com/ http://allenbrowne.com/tips.html

There are many more out there but they are a good place to start

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜