On Lost Focus

khurram7x

Registered User.
Local time
Today, 16:09
Joined
Mar 4, 2015
Messages
226
i'm working on a database about employees and training programs that they need to go through before they go for on-field work. On employee form my boss wants that as soon as I enter Project # and employee Job Title, it automatically search from the other table the required trainings against the Project # and Job Title.

As I see, I need to check both fields on trigger On Lost Focus event whether they both are filled and then apply some kind of a query/macro to fill the Required Trainings field on the employee form.

How could I achieve that please??
Please avoid VBA because I don't understand it at these early stages, but I've started to understand Queries and Macros.

BTW: Can I use character string as a common field between two tables?? I don't feel a need of adding another field/ID just for the sake of relationship, plus my boss is not interested to enter an extra field in relationship table. I've Job Title column in common, that I could use for relationship in other table.

Thanks.
 
Easier question first: Yes, you can use text fields as keys and so can use the same text values in two tables as the linking or common field. The reason most people avoid this for complex databases is size issues. The bigger the text field, the slower your relationship will be when you attempt to use it, because text fields that are large take longer to compare and occupy more space in the table index (which means fewer indexes per data buffer).

Now, the other question - without using VBA here, you will severely limit yourself. Your idea is quite correct - on the Lost Focus event, you look at the field you just left behind and see if it qualifies for whatever you wanted to do. You can do this trivially with VBA but Macros have a harder time testing for specific values or triggering other actions based on the tests.

I avoid Macros so much that I actually can't tell you how to do this. To me, they are the least useful of all features available in terms of direct event triggering. They can work better inside VBA code if you do minimum testing and then do a RunMacro from the VBA once all the complex testing is done.
 
Easier question first: Yes, you can use text fields as keys and so can use the same text values in two tables as the linking or common field. The reason most people avoid this for complex databases is size issues. The bigger the text field, the slower your relationship will be when you attempt to use it, because text fields that are large take longer to compare and occupy more space in the table index (which means fewer indexes per data buffer).

Now, the other question - without using VBA here, you will severely limit yourself. Your idea is quite correct - on the Lost Focus event, you look at the field you just left behind and see if it qualifies for whatever you wanted to do. You can do this trivially with VBA but Macros have a harder time testing for specific values or triggering other actions based on the tests.

Thanks for clearing things up about text fields. One things I need to clarity please. We normally use Primary/Foreign Key combination for this purpose. Primary keys, as ID's, can be generated automatically but we need someone to fill in Foreign Keys in the other table and no body wants to fill in the extra information, especially when it is just for the sake of underlying process. What does DB guys normally do in these case?? What process do they normally use to fill in the Foreign Keys in other table please??

I would start working on VBA, I've just started a month back and going through other features and trying to find their usefulness.
 

Users who are viewing this thread

Back
Top Bottom