Results 1 to 3 of 3

Thread: On Lost Focus

  1. #1
    Join Date
    Mar 2015
    Posts
    17

    Unanswered: On Lost Focus

    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.
    Last edited by khurram7x; 03-31-15 at 03:05.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    as to do this using macros, can't help you there, matey. I don't use macros with the exception of ones such as do cmd within VBA.

    as to:-
    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.
    yes you can use any suitabel datatype for a primary / foreign key realtionship. far to often access developers use an autonumber column when there is no need, and often when doing so can cuase RI problems. use an auitonumber column when you need to. Usually thats becuase:-
    there is no obvious other column(s) for a PK
    the resultant PK becomes unwieldy (through complexity
    the possible PK may change (something you really don't want in a PK. so a surname isn't neccesarily a good candiate for a primary key as a surname may change through deed pool, marriage or possibly not known at the time a row is created.

    the choice of what makes a suitable PK is down to the system. quite often I use text columns as a PK (ferisntance payment types (CHQ: cheque, CSH cash and so on....) the advantage is that its unique but also immedi\ately legible in the tbales. it also means is transparnet to users so you can (possibly save a few characters in forms and reports

    Im always reluctant to hear my boss wont allow that. if the boss knows thgere stuff then fine, but all to often the boss'es knowledge can be way off the mark.

    not knowing what your system is trtying to track buyt job title may not be a good PK.
    why
    well the company could suffer from grade inflation (eg the same role is re classified)
    a person could change job title over time, but the dependant rows need to stay with the employee
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2015
    Posts
    17
    Quote Originally Posted by healdem View Post
    as to do this using macros, can't help you there, matey. I don't use macros with the exception of ones such as do cmd within VBA.

    as to:-

    yes you can use any suitabel datatype for a primary / foreign key realtionship. far to often access developers use an autonumber column when there is no need, and often when doing so can cuase RI problems.
    Thank you for clearing on Primary Key. My boss knows about how tables and relationship works, but he doesn't have a problem adding an extra column for PK/FK purposes... only thing is that I need to fill in the FK automatically via some matching Macro/VBA system to corresponding PK in other table.

    In my design I was looking to use Training Description column from Trainings table as PK (that's because no one wants to fill in extra TrainingID column in both tables), and FK part will act in Employee table where each Employee is assigned to pass one or few of the trainings before they start working physically on site. Does my PK sound sensible??

    Ok, if you could mention VBA code on how to fill in the Combo Box automatically based on my criteria in first post... I'll try to make sense of it and use. I guess initially I need to know at least the basic understanding on how VBA editor could be used, before I start coding myself later.
    By the way, does knowledge of SQL programming helps in VBA programming??

    Thanks for help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •