473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Concentrating form name with string variable

176 100+
Hi All.

Is it possible to concentrate
dim frm as Form
set frm = Forms! & strVar
or
dim frm as Form
strVar = "Forms!frmFormName"
set frm = strVar

in any way, for purposes of using the form name as a variable?

Thanks for your attention.
Feb 27 '07 #1
4 4108
Michael R
176 100+
Hi All.

Is it possible to concentrate
dim frm as Form
set frm = Forms! & strVar
or
dim frm as Form
strVar = "Forms!frmFormName"
set frm = strVar

in any way, for purposes of using the form name as a variable?

Thanks for your attention.
No need to help, I've found the answer:

strVar = "frmFormName"
set frm = me(strVar)
Feb 27 '07 #2
NeoPa
32,556 Expert Mod 16PB
Michael, I'm afraid what you have isn't quite right :(
If you want a variable that references the current form (The form associated with the module rather than the currently selected form I mean) then Me on its own is required.
Me is already available obviously, but can also be used as :
Expand|Select|Wrap|Line Numbers
  1. Set frm = Me
Normally in this case it is sufficient to use Me.
If you have a form's name already in a string (say strVar) you would instead use :
Expand|Select|Wrap|Line Numbers
  1. Set frm = Forms(strVar)
Feb 28 '07 #3
Michael R
176 100+
Expand|Select|Wrap|Line Numbers
  1. Set frm = Me
Normally in this case it is sufficient to use Me.
If you have a form's name already in a string (say strVar) you would instead use :
Expand|Select|Wrap|Line Numbers
  1. Set frm = Forms(strVar)
Thanks, NeoPa.

That actually works.

What do I have to do in case of subform, I've tried the following with no success:
Expand|Select|Wrap|Line Numbers
  1.     Dim frm As Form
  2.     Dim strForm, strForm1, strForm2 As String
  3.     strForm = "Customers"
  4.     srtForm1 = "Customer_Details"
  5.     strForm2 = "Form"
  6.     Set frm = Forms(strForm)(strForm1)(strForm2) 'doesn't work
  7.     Set frm = Forms(strForm)(strForm1) 'doesn't work
  8.     Debug.Print frm.Filter
Mar 1 '07 #4
NeoPa
32,556 Expert Mod 16PB
Thanks, NeoPa.
That actually works.
Oh, sound surprised why don't you :D
What do I have to do in case of subform, I've tried the following with no success:
Expand|Select|Wrap|Line Numbers
  1.     Dim frm As Form
  2.     Dim strForm, strForm1, strForm2 As String
  3.     strForm = "Customers"
  4.     srtForm1 = "Customer_Details"
  5.     strForm2 = "Form"
  6.     Set frm = Forms(strForm)(strForm1)(strForm2) 'doesn't work
  7.     Set frm = Forms(strForm)(strForm1) 'doesn't work
  8.     Debug.Print frm.Filter
Not a problem Michael.
Here's one I prepared earlier...
(Referring to Items on a Sub-Form).
Let me know if you have any problems after reading that.
Mar 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
10
by: Kathy Burke | last post by:
HI. in asp.net app, I have an xmlDocument that I transform to the client html. Using xsl I create a few textboxes to capture user input. Each of these are related to <data> elements in the xmlDoc....
8
by: Paul Craig | last post by:
Hi, I am currently able to open forms given a string variable using the following code: Dim strForm As String = "Form1" Dim theForm As Form theForm =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.