473,387 Members | 1,529 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,387 software developers and data experts.

Name of Control in expression

Hi,

I have a need where I need to search through my form and identify
forms that start with a certain string.

I have found out using this newsgroup how to use "Typeof" command in
an expression in order to identify certain type controls, howver is
there a similar function for control name rather than type?

Thanks.

Pooya
Nov 13 '05 #1
3 1166

Pooya wrote:
Hi,

I have a need where I need to search through my form and identify
forms that start with a certain string.

I have found out using this newsgroup how to use "Typeof" command in
an expression in order to identify certain type controls, howver is
there a similar function for control name rather than type?

Thanks.

Pooya


So loop through the controls collection on your open form.
dim ctl as control
for each ctl in me.controls
if left$(ctl.name,3)= "txt" then
....
next ctl

Nov 13 '05 #2
Pooya wrote:
I have found out using this newsgroup how to use "Typeof" command in
an expression in order to identify certain type controls, howver is
there a similar function for control name rather than type?


<aircode>

function fListControlName(f as Access.form, strStart as string)

'f is an OPEN form in design, datasheet or form view
'strStart is the start of the control name you are looking for
'used inb the debug window
'To find control names beginning with "Oooga", on debug window type
' fListControlName(forms!frmMyForm, "Oooga")

dim c as Access.control
dim intL as integer 'length of strStart

intL = len(strStart)

for each c in f.controls

if left(c.name,intl) = strStart then debug.print c.name

next

end function

You can adapt the above as necessary for your purposes.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #3
Thanks for your help. Both of you.

I will attempt them both.

Pooya
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two...
2
by: MLH | last post by:
A form named frmVehicleEntryForm has a number of textbox controls who's OnGotFocus property setting is an expression... =Change2Green() Change2Green() looks something like this... Dim MyControl...
2
by: Gerry Abbott | last post by:
Hi all. Im using abbreviated field names on a form to optimise space, but would like to display for example, the status bar text of the control, onto the form header, when the control has the...
2
by: SueA | last post by:
Can anyone help me with the code to retrieve the name of the table that a control on a form (that's built off a query) refers to? For instance: qryMfrsAndBrands is based on the tables:...
7
by: rodchar | last post by:
hey all, for simplicity's sake i have a single textbox inside a user control. once i drag that user control onto my page is there a way to attach a binding expression to it at runtime? thanks,...
4
by: Anja | last post by:
Hi everyone, I am trying to use the expression builder to create input to a control in an Access report. I have a table called Records and I want to select the minimum date for a record where...
9
by: Andrew Robinson | last post by:
is there a way of correctly coding this? <asp:TextBox ID="TextBox1" runat="server" MaxLength='<%GetMaxLength()%>' /> and from my cs file: protected int GetMaxLength() { return 5; } Pretty...
3
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
2
by: shalskedar | last post by:
I 've created Report in Ms access which contains subform.The field value in the report is retrieved from the subform.When this report is exported,it shows the error as The expression you entered has...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.