'write your own code' application

  • Thread starter Thread starter NH
  • Start date Start date
N

NH

I want to add a feature into an application where users can add their own
simple code to the application.;

I want my users to be able to add simple rules to the application (I would
design a user-friendly form which would build the code from answers to
simple questions...)

I then want to have a table which will look something like this;

fld_FormName fld_Rule
frm_MyForm1 "If Me![cbo_MyCombo1].Value = 7 then Me!txt_MyTextBox2 =
""Colour"""
frm_MyForm1 "If Me![txt_MyTextBox1].Value = ""Car"" then
Me!txt_MyTextBox2 = ""Engine"""
frm_MyForm2 "If Me![txt_MyTextBox9].Value = ""Dog"" then
Me!txt_MyTextBox2 = ""Age""""
....

Then, when a certain event is triggered, I want to run the lines of code in
the table which are relevant to that form..

Getting as far as the table is fine, but I can't think of any way to 'run'
line of code from a string..

Or to put it even simpler,

If I have a string:

strMyCode = "Me![txt_TextBox] = ""Hello"""

How can I run strMyCode as if it was a line in the application?

If it is important, all of the lines code will be follow the same pattern,
(If a = "x" then b = "y"). I am not making it more complicated than that..

Thanks

Nick
 
That's done it!

Thank you..

Chris said:
Try EVAL function:


strMyCode = "Me![txt_TextBox] = ""Hello"""
Eval(strMyCode)


Chris

-----Original Message-----
I want to add a feature into an application where users can add their own
simple code to the application.;

I want my users to be able to add simple rules to the application (I would
design a user-friendly form which would build the code from answers to
simple questions...)

I then want to have a table which will look something like this;

fld_FormName fld_Rule
frm_MyForm1 "If Me![cbo_MyCombo1].Value = 7 then Me! txt_MyTextBox2 =
""Colour"""
frm_MyForm1 "If Me![txt_MyTextBox1].Value = ""Car"" then
Me!txt_MyTextBox2 = ""Engine"""
frm_MyForm2 "If Me![txt_MyTextBox9].Value = ""Dog"" then
Me!txt_MyTextBox2 = ""Age""""
....

Then, when a certain event is triggered, I want to run the lines of code in
the table which are relevant to that form..

Getting as far as the table is fine, but I can't think of any way to 'run'
line of code from a string..

Or to put it even simpler,

If I have a string:

strMyCode = "Me![txt_TextBox] = ""Hello"""

How can I run strMyCode as if it was a line in the application?

If it is important, all of the lines code will be follow the same pattern,
(If a = "x" then b = "y"). I am not making it more complicated than that..

Thanks

Nick


.
 
Back
Top