Avatar of LizzJ
LizzJ
 asked on

link row source values to data in another table using VBA

Hi Experts,

I have two Access tables: myTable and RefTable

In RefTable, I have two fields: From, To which hold number values. E.g.
From  To
 0        3
 4        8
 9       16

In myTable, I have a field: Brackets
Now I want to set the row source of this field to such that it contains a value list like:
0~3
4~8
9~16
>16

Values in RefTable may change and I want the values in myTable.Brackets to change accordingly. E.g.

RefTable                              myTable
=========                         ==========
From  To                             value list in Brackets:
  0       5                 <=>         0~5
  6       17                              6~17
                                             >17

Can anyone help provide VBA codes for such purpose?
Microsoft AccessVisual Basic Classic

Avatar of undefined
Last Comment
Natchiket

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Natchiket

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Natchiket

lines 10 & 11 should be
strSQL = "INSERT INTO myTable(Brackets) SELECT '>' & Max([To]) FROM RefTable"
db.execute strSQL, dbFailOnError   'Add the greater than bit
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23