For example, there is database table (as attached screenshot), there is field ID =1, 2, 3, 4, 5, etc.... For each ID, it has a set of variable. Per screenshot example, ID=1 has 4 variable K1, K2, K6, K8; ID = 2 has 4 variable K1, K3, K5, K8
For different ID, it can have same variable. The variable look same, but they are two different things. Assuming that a google employee and a facebook employee have exact same name, but they are two different person, same name does not mean anything.
Now here is my question: I don't know what variable are under each ID. For example, for ID =1, I don't know how many variable and what they are, but I know to write VBA code to run a query and get those four variable K1, K2, K6, K8, then I can write below VBA code.
ID is input data of form, when user choose a ID, the program should has its variables in the program.
If user chooses ID = 1, the code should look like below:
Step 1: Write VBA to run query for variable where ID =1Please Login or Register to view this content.
Step 2: There are four returned variable from step 1, how to Dim those four variable in the program. Above sample code is written manually after I run step 1 code. The question is how to write the code dynamically (automatically using the result from step 1)?
Similarly, if user chooses ID = 2, the code should look like below:
I am not sure if I explain my question clearly. I have tried my best to make up an example table. I can explain more if it confuses you.Please Login or Register to view this content.
Thanks.
Bookmarks