Access / Input masking / validation
#1
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
basically i havent got a clue or a hint how to do this.
basically when the type is selected i want the weight limit to change automatically!
But how would do setup the weight limit bit
[edited = I can do this when i setup the VB easy - just i want it setup at the design level]
Si
[Edited by super_si - 10/22/2002 10:34:35 PM]
basically when the type is selected i want the weight limit to change automatically!
But how would do setup the weight limit bit
[edited = I can do this when i setup the VB easy - just i want it setup at the design level]
Si
[Edited by super_si - 10/22/2002 10:34:35 PM]
#2
Scooby Regular
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes
on
0 Posts
Si,
If you make the 'type' a combobox then the combo should have an OnChange event where you can then alter the weight textbox value.
It'll be something along those lines anyway, Im not big on access forms
Gary
If you make the 'type' a combobox then the combo should have an OnChange event where you can then alter the weight textbox value.
It'll be something along those lines anyway, Im not big on access forms
Gary
#3
I guess what you really mean is that whan you change the Type, the weight of the vehicle can't exceed the max weight for that vehicle type.
Looks like your data model is a bit wrong
Maybe the data model should be ...
VEHICLE has Reg Num and Type_Id and Weight
TYPE (which you don't have) has a Type_Id, Type Name and Weight Limit
..you don't put the Weight Limit on VEHICLE - that's a horrible normalisation to be burdened with
The validation rule is not that simple, but along the lines of
VEHICLE.Weight <= TYPE.Weight Limit WHERE VEHICLE.Type_Id = TYPE.Type_Id
...the validation rule doesn't make anything change on the screen - it just stops the user tabbing away from the field with an incorrect value
HTH
Looks like your data model is a bit wrong
Maybe the data model should be ...
VEHICLE has Reg Num and Type_Id and Weight
TYPE (which you don't have) has a Type_Id, Type Name and Weight Limit
..you don't put the Weight Limit on VEHICLE - that's a horrible normalisation to be burdened with
The validation rule is not that simple, but along the lines of
VEHICLE.Weight <= TYPE.Weight Limit WHERE VEHICLE.Type_Id = TYPE.Type_Id
...the validation rule doesn't make anything change on the screen - it just stops the user tabbing away from the field with an incorrect value
HTH
#4
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
like you said thats on the access forms.
I can quite easy do it in VB. Just thought id also program it into the actual database. Just done all the other input masks.
Off to input data and see what works and doesnt
Thanks martyn think ill leave it be
Si
[Edited by super_si - 10/22/2002 10:48:02 PM]
I can quite easy do it in VB. Just thought id also program it into the actual database. Just done all the other input masks.
Off to input data and see what works and doesnt
Thanks martyn think ill leave it be
Si
[Edited by super_si - 10/22/2002 10:48:02 PM]
#6
Well, in a proper system you should 'code' it in the database as well, because you can't guarantee that all data input is via your VB forms only...like someone writes a batch load program and writes straight to your database, filling it with vehicle weights that are over the weight limit for the vehicle type
..then you/your database would be in a mess!
BTW it's called DECLARATIVE REFERENTIAL INTEGRITY...go STW to find out more
Good luck...
..then you/your database would be in a mess!
BTW it's called DECLARATIVE REFERENTIAL INTEGRITY...go STW to find out more
Good luck...
#7
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
Cheers, i just wanted to setup the database the same as my vb form so its all validated and inputted correct.
Ill play tomrrow with it.
Si
Ill play tomrrow with it.
Si
Trending Topics
#8
Stupid qu - not that stupid actually
I don't think you can - apart from deleting the table and re-creating it...but to do that efficiently you need to have your database design as a set of DAO CREATE statements (look in Access Help) rather than using the Access UI to create the tables
...again in a real system, you should be able to re-create your database from a set of scripts if it gets corrupted
Good luck again...
I don't think you can - apart from deleting the table and re-creating it...but to do that efficiently you need to have your database design as a set of DAO CREATE statements (look in Access Help) rather than using the Access UI to create the tables
...again in a real system, you should be able to re-create your database from a set of scripts if it gets corrupted
Good luck again...
Thread
Thread Starter
Forum
Replies
Last Post