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

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.
 
P

pietlinden

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
 
J

Jesper F

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.
 
L

Linq Adams via AccessMonster.com

In order to "save it back into the procedure" your form would have to be
opened in Design View, not the view you use when running the form. I have to
tell you, the entire idea is terrible, and it's not going to help you
"maintain a large database with a lot of code more easily!"
 
I

IgaJim

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...?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top