If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Input Mask or Validation?
I need to set Primary key field so that user has to enter 2 Letters and 4
numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve |
#2
|
|||
|
|||
Input Mask or Validation?
This input mask will work:
LL0000 -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "k11ngy" wrote in message ... I need to set Primary key field so that user has to enter 2 Letters and 4 numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve |
#3
|
|||
|
|||
Input Mask or Validation?
On Sat, 16 Jan 2010 01:31:01 -0800, k11ngy
wrote: I need to set Primary key field so that user has to enter 2 Letters and 4 numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve Either would work; the input mask might be a bit friendlier, as the validation rule message can be cryptic. Try a mask of LL0000 and/or a validation rule LIKE "[A-Z][A-Z]####" -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Input Mask or Validation?
"Arvin Meyer [MVP]" wrote in message ... This input mask will work: LL0000 -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "k11ngy" wrote in message ... I need to set Primary key field so that user has to enter 2 Letters and 4 numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve |
#5
|
|||
|
|||
Input Mask or Validation?
Hi Steve,
Personally, I would use a validation rule. Input masks are generally a pain-in-the-butt to deal with. Try the following validation rule at the table level (so that it will apply to any query or form that uses this table as a record source): LIKE "[A-Z][A-Z][0-9][0-9][0-9][0-9]" Also, I would set a unique index [Indexed: Yes (No Duplicates) ] on this field, but I would not set it as the primary key, simply because I have a strong preference for using the meaningless Autonumber data type as a primary key. A text-based primary key will require you to check off the Cascade Update option for a relationship with enforced Referential Integrity, if you later need to change the value of this field, and have that value cascaded to related child records. If the field is only present in a parent table as a uniquely indexed field, you are free to change it's value at any time in the future, without having to deal with potential locks on related records that other users may be editing, in a multiuser environment. More discussion on Cascade Updates, he http://www.granite.ab.ca/access/cascadeupdatedelete.htm Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "k11ngy" wrote: I need to set Primary key field so that user has to enter 2 Letters and 4 numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve |
#6
|
|||
|
|||
Input Mask or Validation?
PS. Don't forget to include the appropriate Validation Text, such as:
This field requires two letters followed by four numbers. You might also set the Field Size to 6, and set a unique index as I mentioned in my previous reply. Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "Tom Wickerath" wrote: Hi Steve, Personally, I would use a validation rule. Input masks are generally a pain-in-the-butt to deal with. Try the following validation rule at the table level (so that it will apply to any query or form that uses this table as a record source): LIKE "[A-Z][A-Z][0-9][0-9][0-9][0-9]" Also, I would set a unique index [Indexed: Yes (No Duplicates) ] on this field, but I would not set it as the primary key, simply because I have a strong preference for using the meaningless Autonumber data type as a primary key. A text-based primary key will require you to check off the Cascade Update option for a relationship with enforced Referential Integrity, if you later need to change the value of this field, and have that value cascaded to related child records. If the field is only present in a parent table as a uniquely indexed field, you are free to change it's value at any time in the future, without having to deal with potential locks on related records that other users may be editing, in a multiuser environment. More discussion on Cascade Updates, he http://www.granite.ab.ca/access/cascadeupdatedelete.htm Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "k11ngy" wrote: I need to set Primary key field so that user has to enter 2 Letters and 4 numbers as serial number for hardware. Do I use Input mask or Validation rule? What would be the expression? Thanks for help Steve |
#7
|
|||
|
|||
Input Mask or Validation?
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?= AOS168b AT comcast DOT net wrote
in news Input masks are generally a pain-in-the-butt to deal with. Everyone says this. I don't understand it. Input masks do things that cannot be done otherwise without substantial coding. I see no reason whatsoever not to use them where appropriate (although dates are about the only type of data I use them for regularly). -- David W. Fenton http://www.dfenton.com/ usenet at dfenton dot com http://www.dfenton.com/DFA/ |
#8
|
|||
|
|||
Input Mask or Validation?
Hi David,
Try copying data from one source (say an e-mail message), and pasting it into a text box on a form that includes an Input Mask. I don't know about you, but I've found that this generally fails even if the data is in the correct format for the mask. The mask work fine when typing data in, but I seem to have lots of problems in the past trying to paste data in from the clipboard. Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "David W. Fenton" wrote: =?Utf-8?B?VG9tIFdpY2tlcmF0aA==?= AOS168b AT comcast DOT net wrote in news Input masks are generally a pain-in-the-butt to deal with. Everyone says this. I don't understand it. Input masks do things that cannot be done otherwise without substantial coding. I see no reason whatsoever not to use them where appropriate (although dates are about the only type of data I use them for regularly). -- David W. Fenton http://www.dfenton.com/ usenet at dfenton dot com http://www.dfenton.com/DFA/ |
#9
|
|||
|
|||
Input Mask or Validation?
On 16 Jan 2010 22:29:14 GMT, "David W. Fenton"
wrote: Everyone says this. I don't understand it. Input masks do things that cannot be done otherwise without substantial coding. I see no reason whatsoever not to use them where appropriate (although dates are about the only type of data I use them for regularly). Hi David, I have to disagree with you on using input masks for dates. I find them very presumptuous. How does the developer know how I enter dates? Maybe I use 2 digit years, maybe 4. Maybe I use slashes or hyphens. Maybe I type "jan 16". Access handles all of this with *no* coding. Input masks might make it easy for the developer, but not so much for the user. The only place I've seen a *possible* use for input masks is for SSN. The format is consistent enough that they can be helpful. But even then, I'd rather accept the SSN with or without hyphens, and then run it through a quick cleanup, validation and hyphenation function. Armen Stein Microsoft Access MVP www.JStreetTech.com |
#10
|
|||
|
|||
Input Mask or Validation?
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?= AOS168b AT comcast DOT net wrote
in : Try copying data from one source (say an e-mail message), and pasting it into a text box on a form that includes an Input Mask. I don't know about you, but I've found that this generally fails even if the data is in the correct format for the mask. The mask work fine when typing data in, but I seem to have lots of problems in the past trying to paste data in from the clipboard. Input masks are for typing. If you are pasting arbitrary data into the field from the clipboard, and this is by design, then you shouldn't use a date mask. That's not what they are for, so it's fine not to use it in that case. But it's not a flaw in input masks. Input masks do exactly what they were designed to do, restrict typed input. -- David W. Fenton http://www.dfenton.com/ usenet at dfenton dot com http://www.dfenton.com/DFA/ |
Thread Tools | |
Display Modes | |
|
|