Set FormName with variable in VBA

M

Mario

Hi there ,
Maybe the subject is not clear , but i'll try to explain here.

I'd like to change the formname in the next code with a variable :
ex : Forms!FrmOrders.Controls("CmdAdd").Caption = "Add"
change it in : Forms!VARIABLENAME.Controls("CmdAdd").Caption = "Add"
I get the formname from a table/query

I tried to do this , but it always gives me an error.

Can anyone help me with this.
Thanks
Mario
 
M

Mario

Hello again ,
I've just read the HELP (F1) in Access , and found the solution there.
Just use brackets around the variablename
Forms(VARIABLENAME).controls............
Mario
 

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