I’ve been creating a sort of program in Microsoft Access 2007 and the program is working quite well but I don’t know how to limit the values in table design…
Can you guys please show me how to?
Like Member ID(Number): It should be limited from 1 to 99999 (5 digits maximum)
Phone Number(Number): It should be limited to 7 digits [Not less or more digit(s)]
Concerning the date format: It is MM/DD/YY and I want to change it to DD/MM/YY but I don’t seem to know how to
If you familiar with VBS then it would be easy. I think there’s some options in field properties to set limitation in field value. I never make a program with Access but I know that Access using the same language and a limited function of Visual Basic programming language.
When I’m doing database programming, I always put any rule or limitation like what you’ve describe in my code rather than field properties of my database.
Well my teacher said that there is no need to use Visual Basic programming language since this is not for our level yet…(Next year learning it if computer sub is optional)
Erm…Can teach me how to limit it using the VB language ^^?
Well, your teacher is right. What I’m saying is Ms. Access is using the same language and a limited function of VB, I think the syntax is quite the same when you’re creating macro with Word or Excel.
I think you could create such limitation when you’re designing form for your database in Access.
e.g. You’re creating a textbox which named TxtMemberID which linked to your Member ID field in your database the simple syntax for limiting the entry would be like this :
Private Sub TxtMemberID_Validate(Cancel as Boolean)
If TxtMemberID.Text < 1 Or TxtMemberID.Text > 99999 Then
MsgBox (“Error. The accepted value must be between 1 to 99999”)
Cancel = True
End If
End Sub
The syntax I describe above is a simple example of how VB language written. Of course you can use other graceful method of limiting data entry by using other means like string function (Str), etc.
I can’t give you precise example because I’m not using and installing Ms. Office in my machine nor do I’ve ever doing VB Database Programming with Access (I’m using SQL Server as database).
Well, that’s what VB is. An Object Oriented Programming language. Basically all programming language are just the same. It uses the same algorithm though using a different syntax or methods.