dynamic variable names

emalrola

New member
Local time
Today, 14:00
Joined
Jan 27, 2004
Messages
6
I have a form with lots of control fields called things like session1 id, session1 start time, session2 id, session 2 start time etc

I have a table which I query to poulate these fields.

I wanted to knock together a quick generic function where I could set the values of all the relevant control fields for the session.

so I have a function called get_session_details which takes 1 parameter - session number.

I then query the table to get all the relevent values for, session 1, say.

I then want to assign the values to the session 1 control fields.

I though it would be easy to dynamically create a set command to do this (ie; creating the form variable name) but I there doesn't appear to be a docmd setvalue.

I sure it must be possible - but how?

(My VBA programming is somewhat limited - I'm an Oracle person really...)

Any ideas?

Thanks
 
Thanks for a swift reply!

Yes, my underlying database is absolutely normalised.

(I have been normalising data for 20 years and am fully confident in this area! Its just the VBA I'm not sure about...)

It may be that I just can't do what I need to with VBA/forms - I tend to favour generic code that I can re-use from many forms. I could hard-code all the control names into the code, but it seems a little restrictive when I am actually doing the same thing lots of times.
 

Users who are viewing this thread

Back
Top Bottom