Field name in MS Access table - s1
data type - text
I use this field to store student marks.
'AA' will be entered if the student is absent and therefore I have selected text data type for this field
I want to restrict data entry to minimum marks = 0 and maximum = 75
How do I enter validation rule in this text field?
You may want to reconsider your decision to store the values as Text. You could store them as Numeric and just use a custom Format property to display AA when the value is Null (which is allowed when "Required=No"):
Set maximum length of the text of the field to: 2
Set validation rule to: "AA" Or Between "00" And "75"
Also, apply an inputmask to force two characters, or make sure that values between 0 and 9 are entered as 00 and 09.
In design view for your table that will store the student mark, select the student mark field.
In the field properties in the lower part of the screen set the Field Size to 2, the Validation Rule to "AA" Or Between "0" And "75" and then in the Validation Text field, write a helpful message to the user describing the valid data they can enter in to this field:
If the user tries to put in data outside the restrictions of your validation rule, they'll see your validation text message and won't be able to save their invalid data:
Related
Can I use a condition with a variable that I created? Specifically, how can I indicate that the variable value [text and/or numbers ] with max of 15 characters for the user input? I've been trying to set the condition in order to verify the user input of characters, with max of 15 characters between text and/or numbers, but it dosen't work. I've made a variable [ $codice_fiscale ] but I can't aplly the condition. Can you please help me in order to make it work?
I have a data source which contains fields with periods in their name. e.g.
[{
"id": 1234,
"OD.name": "Andrew",
"OD.age": 21
},{
"id": 1235,
"OD.name": "Roofus",
"OD.age": 22
}]
However, when I bind this to the grid the values for columns which contain periods in their field names are not rendered. Is this a known bug/not-supported in ag-grid?
Just make sure that suppressFieldDotNotation is set to true.
From the ag-grid reference
https://www.ag-grid.com/javascript-grid-properties/
If true, then dots (eg address.firstline) in field names are not
treated as deep references. Allows you to use dots in your field name
if you prefer.
The field name is going to be interpreted by the grid as an expression, so if you provide a field name.of "OD.name", it will try to find the "OD" property of your data row, and then try to find the "name" property of that. Of course, that's not going to work.
However, you can supply a "valueGetter" function in your column definition, which will be responsible for supplying the value to the grid. In that function, you can do whatever you need to do to get the value from the row and return it.
I have a uID field linked to an auto number field Num that generates unique, custom numbering for each record in a table.
However the Expression used for the Data type keeps returning an error.
If Field1 = "Cat" then field (uID) must return "C" & [Num]. With the number format "000". ie C001, C010, C121 etc
IIf([Field1]="Cat","C" & formatNumber([Num],3) & [Num],"Unknown")
It seems Access doesn't recognise formatNumber used in this manner.
put this code in your textbox control source
=IIf([Field1]="Cat";"C"+Format([NUM];"000");Null)
this will give you the output what you need.
I have a field in an MS Table set to number for month number.
field type = Number
Field Size = single
Validation Rule= (Not Is Null) or (>0 and <13)
Validation Text = The month must be between 1 and 12
Required=Yes
If no data is entered I get the system error "You must enter a value in the dim_daod.daod_month field."
I want it to trigger the Validation Text instead.
What should the Validation Rule be?
You want your validation rule to be
(Not Is Null) And (>0 And <13)
instead.
If you still have the Required parameter set to yes then you'll need to intercept that the "You must enter a value in the field" message on your data entry form.
Alternatively, you can set the validation at the table level using the same criteria and message
( daod_month Is Not Null) And (daod_month>0 And daod_month<13)
A client is looking to have a number field in a database that goes from 1 - 10. However, they would also like the option of "more than 10". Are there any best practices for adding this to a number field (integer) or is it even possible?
This feels like an inane and simplistic question and I'm hesitant to ask it but searches have revealed nothing and I feel like I may be missing a simple trick.
No, not with Access (and most other database applications) anyway. Number fields can only contain valid numbers (or nothing, if NULL is permitted), and neither "more than 10" nor "> 10" is a valid number.
Years ago I did a bit of work with FileMaker Pro and I remember it being quite "loose" in what it would allow to be entered into a field of a given "type". The field's "type" seemed to be more of a "suggestion" as to how an entry was to be interpreted. That opened up a certain degree of flexibility (to handle cases such as yours), but it also often left the user vulnerable to whatever assumptions the software made when interpreting a peculiar value.
In any case, "> 10" would have to be handled as a special case, so you'd probably do just as well to make the field a text field and use a combo box to select the values
1
2
3
...
9
10
more than 10 (or "> 10")
If you want to limit the user's selection to a valid value, i.e. a numeric value between 1 and 10 or a value of "more than 10", I would:
Create a lookup table with two fields ID (long), RecValue (text).
The table will have 11 records, where ID will have the values 1 to 11 and RecValue "1","2",..."10","more than 10".
Use a combobox for the data entry:
RowSource=
Bind on the ID field but show only the RecValue field.
Set "Limit to list" property to TRUE.
The user sees text, but behind the scenes you are using a numeric value.