limit records into a table by using VBA code

johnqzsmith

Registered User.
Local time
Yesterday, 19:37
Joined
Apr 25, 2004
Messages
13
I would like to find a way to limit records into a table by using VBA code. I have a couple of tables that contain data specific to the user (licensed). It is my understanding that these are much safer if entered in code vs. sitting out in a table where clever users may track them down.

For example, let’s say I only wanted to allow 3 records into tblMasterTable. I can set the validation rule (in design view of the table) to have the PrimaryKey (integer): > 0 And <= 4. However, I would like to employ a global constant in VBA that would be hidden from the users which would accomplish this same thing, but in a more secure fashion.

E.g., Public Const gconMtableLimit As Integer = 3

That seems easy enough to write out, but how do I “make it stick”. That is, how do I relate that constant to what can/can’t be done with regards to the number of records in tblMasterTbl?

At present, the application is one file, but I will be splitting it soon into fe/be dbs.

Thanks,

JQ
 
Tables don't have code associated with them. You could create a form based on a table then use VB in the form to validate the information entered into the form by the user.
 

Users who are viewing this thread

Back
Top Bottom