Results 1 to 5 of 5

Validating a field based on the selection of another field

  1. #1
    4Michael is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2019
    Posts
    3

    Validating a field based on the selection of another field

    Hello!,
    I am a new member in this group, and great to be here. I am Michael.
    I will appreciate getting assisted in figuring this out.

    I have a form with two Combo boxes, both are dependent. Now what I want to achieve is, Example, in Combo Box A TYPE, I have options like HP, Lenovo, Dell etc, and Combo box B, I have options like YEAR: Released 2003, Released 2005, Released 2008 etc. Now, I want users who select Lenovo to be mandated to select the year of released. If other options are selected, they can skip the year of released.

    I thought this could be done from the Validation rule, I used this line of Validation([TYPE]="LENOVO" And [YEAR_RELEASED] Is Not Null) Or ([TYPE]<>"LENOVO" And [YEAR_RELEASED] Is Null))



    This isn't working.

    thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,699
    put them in a table.
    LEVONO, 2005
    LEVONO, 2006
    IBM, 2003
    etc

    when user picks cbo1 LEVONO
    refresh cbo2 to see the choices for that cbo1 pick

    cbo2.requery

    (sql for cbo2= select [year] FROM table where [type]=forms!myForm!cbo1)


  3. #3
    4Michael is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2019
    Posts
    3
    thanks, but what I need is, users who select other options are free to proceed, but users who select LENOVO must select year else they should not be able to proceed.
    the above option has been tried, only he sql query was not exactly this was....

  4. #4
    4Michael is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2019
    Posts
    3
    Apologies for cross-posting please.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,279
    Quote Originally Posted by 4Michael View Post
    Apologies for cross-posting please.
    This means you have posted this question elsewhere? Then it's customary to provide a link to the other forum. Or do you think that cross posting is what you do when your thread isn't getting noticed so you post a comment yourself? That's known as bumping.

    Your situation requires that you use an event suitable for checking whether or not the 1st combo contains Lenovo, and if so, not allowing the record to be saved. Cannot advise what that might be without knowing the process.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.

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: 5
    Last Post: 04-17-2016, 08:13 PM
  3. Replies: 1
    Last Post: 06-26-2015, 02:12 PM
  4. Replies: 4
    Last Post: 01-23-2014, 04:34 PM
  5. Replies: 10
    Last Post: 11-21-2011, 02:56 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
  •  
Tech Forums: Microsoft Office Forums