Consulting

Results 1 to 3 of 3

Thread: Access isn't picking the right values

  1. #1
    VBAX Newbie
    Joined
    Aug 2020
    Posts
    1
    Location

    Access isn't picking the right values

    Hello there,

    I am making my first database and running into a small problem.
    I created two tables which are linked via a 1:n relationship. In a form I took the main table and created a combo box with the values of the second table. Now I want that when the enduser picks a value from the combobox, Access calculates the next date. So for example when I chose "High Risk" Access will take the date ented in the box " Last Review Date" and put this value + 1 year in the field " Next Review Date"

    for this I created a after update procedure

    if Me.CRRB_ID_F = " High Risk"
    Me.Basic_NRDate = Me.Basic_LRDate + 365
    End if

    if Me.CRRB_ID_F = " Medium Risk"
    Me.Basic_NRDate = Me.Basic_LRDate + 720
    End if

    I hope someone could help me there
    Stay safe

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Welcome to VBAX and Access.
    You haven't said what results you actually get.
    You also haven't said what the design of your tables is, or the Combo that you are using for selection.
    The most common problem with combos is that it does not store the "selection that you see", it stores the ID or key field.
    So when you use VBA like
    if Me.CRRB_ID_F = " High Risk"
    maybe you should be using
    if Me.CRRB_ID_F = 1
    or if Me.CRRB_ID_F = 2
    depending on the key field.
    Can you provide more data?

  3. #3
    VBAX Newbie
    Joined
    Oct 2020
    Location
    USA
    Posts
    1
    Oi! Thanks for that, OBP!
    I was already thinking about it as of something impossible.
    editor and app tester at top10spyapps — read my recently published article!

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
  •