Results 1 to 9 of 9
  1. #1
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    310

    field based on an other field value

    Hi to all,




    tlkpCategories is a table with the following fields:
    pkCategoryId, CategoryName, StartNumber, EndNumber

    The StartNumber and EndNumber fields are of Number Data Type


    I have a form with two different controls: a text box named txtCallNumberFinal and a combo box named cboCategory with row source tlkpCategories.
    Each category name has a corresponding number between StartNumber and EndNumber fields.


    My issue is that the user might enter the correct category number but selects the wrong category name in the combo box. So, I want to check that the number used for the text box matches the correct category name.


    Example:
    category 1 is between StartNumber 100 and EndNumber 199.999
    The user input txtCallNumberFinal was 120.256 but he selects Category 6 instead of category 1.


    Which is better in a case like this:
    1- display an error message to alert the user of his wrong category name choice.
    or
    2- the program will display the Category name based on the data input number automatically in the combo box.


    Note:
    The control txtCallNumberFinal is an alpha numeric that starts with numbers and ends with letters. The characters are / alphabets are not important in my case.

    So I think the val() function will be used in a case like this to ignore the apphabets.


    Any help is appriciated

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    ? Why does the user get to choose both Category and Number?
    Seems you could have logic, and if the user knows the Category , you could assign a number from your lkup table,
    BUT readers have no idea of your application/requirements in detail.

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    pkCategoryId, CategoryName, StartNumber, EndNumber
    There are only 4 fields in the table and a user is inputting 1 of them in a textbox first? You could have all of them in a 4 column combo, showing whichever column(s) you want but utilizing only 1 of them.
    Last edited by Micron; 05-28-2019 at 01:15 PM. Reason: correction
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    310
    Hi,
    Each category has a range of numbers not only one number. So any number between 100 and 199.999 can be used for category 1. I hope this makes it more clear.
    It is a library database where for example "mathematics" is a category and a corresponding number is a number between 510 and 519.999. As you can see more than one number ,ight be in one category.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Option 2 - cascading comboboxes - a common topic.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I agree with June re Cascading combos, but I'd like to know more about the application.
    Does Dewey Decimal system approach apply ---if so then cascading combos would seem to handle the taxonomy.

  7. #7
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    310
    Yes, Dewey Decimal System approch apply.
    How many combo boxes should I use?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    However many you need to manage user options.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    310
    Thank you all very much.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-09-2019, 10:22 PM
  2. Replies: 1
    Last Post: 06-15-2018, 09:48 AM
  3. Replies: 2
    Last Post: 05-17-2017, 06:17 AM
  4. Replies: 1
    Last Post: 12-04-2016, 05:43 PM
  5. Replies: 3
    Last Post: 01-09-2015, 05:48 PM

Tags for this Thread

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