Can I bring the code of a procedure into i a textbox?

  • Thread starter Thread starter Jesper F
  • Start date Start date
J

Jesper F

Can I bring the code of a procedure "myfunc" in the module "mymod"
into i a textbox or variable and work with it?
Can I edit it and save it into the procedure afterwards?
I think there may be a wau using some "VBA extensibility"? but I'd
prefer not to reference that.
Thanks for any help.
 
Can I bring the code of a procedure "myfunc" in the module "mymod"
into i a textbox or variable and work with it?
Can I edit it and save it into the procedure afterwards?
I think there may be a wau using some "VBA extensibility"? but I'd
prefer not to reference that.
Thanks for any help.

What's your business goal?
Yes, you can do this, but why? Normally you calculate values on the
fly. You could set the default value to a function name in your form
or use an update query... but I still don't know if this is the best
idea. Hence the questions
 
What's your business goal?

I'd like to read the text of the procedure, bring it into say a
textbox or even just a variable in code, perform som replace/edit
commands on the text and save it back into the procedure.
It's to help me maintain a large database with a lot of code more
easily.
 
You could use dynamic sql.

for example
Private Sub MessWithMySQLCmd()
Dim strSQLCmd as string
Dim strSQLExec as string
Dim strSQLVary as string

strSQLCmd = "delete from table1 WHERE Column1 = "
strSQLVary = "changeablevalue"
'Update the form text value:
Form_Main.VaryText.Value = strSQLVary

'Build the statement
strSQLExec = strSQLCmd & strSQLVary & ";"

'Execute the statement
CurrentDb.Execute strSQLExec

End Sub

You could also use a DAO.Database method.

Hope I helped...?
 
Back
Top