Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

Assign Current Form Name to a variable in VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BlueWolvering - 11 Mar 2008 18:50 GMT
Hello,
Using Microsoft Access 2003,

I would like to assign the current form's name to a variable.

So opening the VBA code for a particular form, at the top I want to

Dim strFormName as String
Set strFormName = {Current Form Name}

How does one go about this?  I know that forms(X).name  but I don't know
what X = for each form and I don't know if changes.

It's not like me.name is it?

Thank you
BruceM - 11 Mar 2008 18:57 GMT
Rather than wonder if something like Me.Name is how to go about it, just
test it.  You are correct, and could have found out in less time than it
takes to post a question and await a reply.

Dim strFormName as String
strFormName = Me.Name

Having said that, I don't know quite what you mean by "at the top".  where
do you want the form name to appear?

> Hello,
> Using Microsoft Access 2003,
[quoted text clipped - 12 lines]
>
> Thank you
BlueWolvering - 11 Mar 2008 19:40 GMT
You are 100% correct.  I feel a bit like a jackass on this one, but honestly
I just forgot about trying it.  Also, I luckily did not wait for it, I just
kept going, and figured I'd fix it when the response came in.  

I thought of me.name just as I was finishing up the post so I just tacked it
on.  

Thanks for reminding me to test it.  I hope I didn't waste too much of your
time.

> Rather than wonder if something like Me.Name is how to go about it, just
> test it.  You are correct, and could have found out in less time than it
[quoted text clipped - 22 lines]
> >
> > Thank you
BruceM - 11 Mar 2008 21:05 GMT
Not a problem for me.  After all, I chose to respond.  I didn't recognize
your moniker, so in case you are new I was just pointing out that there
could be a delay before you receive a response.

> You are 100% correct.  I feel a bit like a jackass on this one, but
> honestly
[quoted text clipped - 38 lines]
>> >
>> > Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.