Topics Search

Allow only 4 digits in field

Allow only 4 digits in field
Views: 126
I need to limit a field on a form, to allow the user to enter time in 24 hour format. But I need to set it to only allow 4 digits, including beginning with zeros. When I use something like Like "####" , it doesnt allow leading zeros. Anybody know how this can be done
Sponsored Links:

More topics


Query that splits digits into 2 seperate fields

I use access 2007 and need to run query that extracts data from a field which has 10 digits(numbers) in it but the first digits(numbers) mean something different from the next 2 digits(numbers). Does anyone how to run a query that would extract those 4 digits(numbers) from the that field and put them into 2 seperate fields which for now I will call field "A" and field "B

If field is < 4 digits add 0's

I have a field in my Access query that is called RequisitionNbr. The numeric data in this field is not consistent as far as the digits. There are some cells with 1 digit number, 2 digit numbers 3 digit numbers, 4 digit numbers etc. I want to add zeros in front of all cells in that field with < 4 digits. Example if this field has 1 digit number like 3, I want the result to be 0003. If it has 2 digits like 24, I want the result to be 0024. If it has a 3 digit number like 424, I want the result to be 0424. Anything 4 digit and above should just be left alone.

Display only the last four digits of identification numbers

I know how to get excel to show only the last four digits of ID numbers. At first I thought I can just import the excel file with the last four digits and hide the column with the full ID numbers but all got imported to Access. If I am stuck with this, how do I get Access field to display only the last 4 digits? I do not want to show "***-**-****", just the last 4 digits only.

In excel I would use the RIGHT function, "=RIGHT(A1,4)." Can I do this type of function, "=RIGHT([field name],4)?

Integer-Based Data Types

A number is a digit (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9), a combination of digits, or a combination of one or more digits, a separator, and one or more digits. Microsoft Access supports three categories of numbers and there are various ways you can apply one to a field. You can work in either the Datasheet View or the Design View of a Table.

On database open check field for blanks and extract last 4 digits from other field?

new question.

I want to make the database (a simple table) loop through every record in the field "Last4SSno" and extract the last 4 digits from "SSno" if the "Last4SSno" field is blank, or if the 4 digits in Last4SSno does not match the last 4 digits of "SSno". I have google searched for hours, but I cannot even think of how to phrase a google query right now, and I'm getting a little fried on the idea. I would prefer to do this on database open, but if it has to be done some other way, that is acceptable as well, I'm just adept enough to modify the code to my own uses, it's just the *Private sub OnDBOpen* part and the *DoCMD.RunSQL Insert * in Last4SSno Right("SSno", 4) where "Last4SSno" isnull* part that I cannot seem to find help on(I think).

I could have the whole problem backwards, I just don't know anymore.

Using Data Types

A number is a digit (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9), a combination of digits, or a combination of one or more digits, a separator, and one or more digits. Microsoft Access provides three techniques or categories of numbers. These should be applied appropriately to make your database as effective as possible. To specify that a column will contain only numeric values, after displaying the table in Design View and selecting the column under Field Name, set its Data Type to Number, Currency, or AutoNumber.

ADD "0" TO the number

I am stuck here for a while and I hope you help me. I have failry large table called NANCAP in a database in where I upload large Excel spreadsheets. There is a filed called code and it can be one digit such as 1,2,3,and so on, and it can be two digits 22,23,50,78 and three digits 100,105. There is not problem with three digits code, but I need two 0's to be added to one and one "0" to be added to two digits code to make like this 003,009,025,050. The code uploaded like this :2,3,50,100,105 .I am trying to do that by using the update query, however I can not fugure out how to put this into query that Access will see where one "0" or two "00" to be added to the filed based on number of digits in the field

Validation rule for account number field

I have a salary table with the one of the field as the Account number. I need to enter the account number in the following format

First four digits are numbers
then a special character | -
then six digits are numbers
then a special character -
and the last three digits can be either 101 or 102

example 1234-567890-101

I have set the data type as text for the account number fields.

Delimit a field within an Access table

New to the forum as a poster, but I've used it a bunch in the past to answer questions. Here is my issue:

I have a field of varying length and format. I want to update a separate field to be everything to the right of a forward slash "/" Can anyone help me with this? We'll call the field "Text ID" and an example of the contents would be "SDI 22532993/130". Also, the number of digits to the right of the "/" varies between 1 and 5 digits.

Changing existing data using an input mask

I have imported data from an excel spreadsheet and there is one field that needs to be 7 digits long. However, when entered they have omitted all the leading zeros. In other words the data says 214 and I need it to say 0000214. Is there a way I can update this field to make all entries 7 digits by adding the preceding zeros?