Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Dec 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lookupfield with VBA ? (Access 2000)

    Create Lookup field with Visual Basic

    Can i create a lookup field on the fly? In my table Students i want to create a loookup field
    TeacherID that looks up teachers by their LastName. Otherwise i use the Lookup wizard in the
    table, then i connect with the table Teachers and then i hide the teaccherid.
    I want to create this lookup field without the help of the wizard.How can i do it ?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Lookupfield with VBA ? (Access 2000)

    Are you trying to modify the table to contain a lookup field (something that really isn't necessary, since your users should never *see* the tables) or are you trying to put the "lookup field" on a form?
    Charlotte

  3. #3
    Lounger
    Join Date
    Dec 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lookupfield with VBA ? (Access 2000)

    Thank you for your reply.I have 2 tables. Customers and Employees.I do not know how to relate them properly. As you say it is not good to make a look up field in the table. My task is to attach an employee to each customer. When the user creates a new customer, then he must choose from the employees available who will be responsible for that customer.
    I could also build a combo box on the form, but somehow it doesnt save the choice i am doing.Because the table Employees is not underlying the form.I also tried to make a query from both the tables, but i cannot do it properly. May be you may want to help me doing the query properly and i will be very grateful to you.

    Many thanks for everything

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Lookupfield with VBA ? (Access 2000)

    You would normally have an EmployeeID field in the Customer table if you are going to attach only a single employee to each customer and you don't care about history. On your form, which would be based on the customers table, you would have a combobox that got its RowSource list values from the employees table, but the ControlSource of the combobox would be the employeeID field in the customer table.
    Charlotte

Posting Permissions

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