Results 1 to 2 of 2

Thread: Look Up before Update

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    52

    Look Up before Update

    Hi. Thanks for all that will respond to this post

    I have a small program to design for a company.

    They have thier staff in different places and they engage in nation wide postings of their staff sometimes.

    I designed a table with the following features:

    1. EmployeeNumber

    2. LocationPostedTo

    3. Name

    Note: their are other information but what is applicable for my question is what I state here.

    Please, I want some body to direct me on what to do on the form I created concerning this table.

    This is my challenge

    1. I call up the employee number though a combo box I designed. It looks through the and apply in the employee name.

    2. I call up the LocationPostedTo combo box and pick the new location the employee is to be posted to.

    Now, I want that before the column is updated, the form should look through the table and check whether this employee has been posted to such location before, and if yes, it should pop up telling me that this employee has been posted to such place before, therefore cannot be posted to such a place again.

    I hope I make myself understood.

    Thanks

  2. #2
    Join Date
    May 2006
    Posts
    407
    As I said in your previous post in an earlier thread started on April 2nd:

    This SQL will give you all the records that are currently in your table for this [employee no] that also have the transferedtolocation:
    Code:
    SELECT [employee no], [transferedtolocation]
    FROM IHaveATable
    WHERE [employee no] = 123 and [transferedtolocation] = 456;
    The "123" would be whatever the employee no is that you are currently working with, and "456" would be the transferred to location that you are interested in for this transaction.
    The form you are dealing with will have an event named BeforeUpdate that you can use to enter the VBA code to run the query with the SQL I have suggested. If the query returns any records you will know this employee has been transferred to this location before.

    If you do not understand what is being said here, then inform us what you don't understand. If what you are doing is asking for someone to code the solution for you, then say so, and also inform us how much you are willing to pay per hour for our programming services.
    This forum is here to help people that need help, not a place to get free programming. I am more than willing to help you work through your problem, but I will not code the solution for you, unless you are willing to pay my normal rate for programming services.

Posting Permissions

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