Results 1 to 12 of 12
  1. #1
    AlexBen is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    10

    Lookup table


    Good day! Am trying to create 2 fields in a table (Medicine and WithdrawalTime). Medicine would be a lookup from a table ListOfMeds.
    ListOFMeds table has 3 fields (PrimaryKey, Drug and Wthrwl). What I want to happen is in my WithdrawalTime field, if I choose DrugA from Medicine, it will automatically show the corresponding Wthwl? Hope that makes sense. Right now am using IF, ElseIf in my form. If I have to add a Drug, I have to add to the EventProcedure.

    Thanks!

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    google "cascading comboboxes"
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi

    Are you saying that the "Wthrwl" field in the table "ListOfMeds" shows the "WithdrawalTime" for the Medicine selected?


    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    Do you mean the last date/time of withdrawal?

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi Ajax

    No sure as the OP has not made this very Clear.

    It would help if the OP would show example data for both his tables.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    I misread your question.

    What I think you want is to set the withdrawltime field = to your combobox for ListOfMeds column 2
    Code:
    withdrawltime= cboMedList.column(2)
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    if that is the correct interpretation you could just put in the textbox

    =cboMedList.column(2)

    no code required

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    am I the only one who thinks this is about lookup fields in a table, which I would have thought most responders would advise against?
    Am trying to create 2 fields in a table (Medicine and WithdrawalTime). Medicine would be a lookup from a table ListOfMeds.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    Quote Originally Posted by Micron View Post
    am I the only one who thinks this is about lookup fields in a table, which I would have thought most responders would advise against?
    You might be. I don't think anyone of us is sure of the question.

    Welcome back, BTW. Hope you had a nice trip.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Via Google:
    Withdrawal time, as relating to veterinary medicine, is defined as the time required after administration of a drug to a dairy cow needed to assure that drug residues in the marketable milk is below a determined maximum residue limit (MRL).[1] This term is often used more broadly to describe the time needed after drug administration to any food animal where drug residue may be found in marketed meats, eggs, organs, or other edible products.

    Hopefully, OP will provide some details to put post in context.

  11. #11
    AlexBen is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    10
    Sorry for the very late reply. been away for a while. The database am creating is not a real database in real sense. All our records are encoded in a website thru a text file (notepad am using). Am just using MS Access so it would be way easier to encode. After I uploaded the text file, i would delete all the records in Access.&nbsp; Anyways, my table, tblTREATMENT has a field DRUGname and DRUGwithdrawalPERIOD among others. Every drug would have its own withdrawal period (days), say DRUG A would have 5 days, DRUG B would be 0 days.&nbsp; In the form, I used a combo box for DRUGname (record source: tblTXT, bound column: 1), i could also do the same for DRUGwithdrawalPERIOD, but both would be showing the Primary Key (autoNumber) in the table.&nbsp; I need tblTREATMENT to show me in the fields DRUGname: Penicillin, DRUGwithdrawalPERIOD: 21 days.<br>The field in tblTREATMENT is the Primary Key, Drug Name, Withdrawal Period and Route of Administration.&nbsp;<br>Hope this clear things up.&nbsp; Thanks in advance!

  12. #12
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi

    OK so on your Form where you have a Combobox to select the DrugName from tblTreatments,
    also inclue the WithdrawalPeriod in your Selection.

    Name the Combobox "cboTreatments"

    Then add am Unbound Control and enter the following as its Record Source:-

    =[cboTreatments].Column(2)

    Name the Unbound Control "txtPeriod"

    Now when you select a Treatment using the Combobox the Period will populate automatically.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 10-10-2019, 05:13 PM
  2. Replies: 3
    Last Post: 06-15-2019, 08:51 AM
  3. Replies: 3
    Last Post: 06-02-2017, 03:49 PM
  4. Replies: 5
    Last Post: 06-25-2014, 09:19 AM
  5. Replies: 8
    Last Post: 03-22-2012, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums