473,626 Members | 3,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

With Statement

access 97

can someone tell me the syntax for a with stement for multiple
controls?

pseudo (doesn't work)

With cmbBox1,cmbBox2 ,cmbBox3
.Visible = False
End With

-doodle

Nov 13 '06 #1
4 5183

doodle wrote:
access 97

can someone tell me the syntax for a with stement for multiple
controls?

pseudo (doesn't work)

With cmbBox1,cmbBox2 ,cmbBox3
.Visible = False
End With

-doodle
AFAIK, you can't do that. You can create a subroutine in your form
that accepts a control/control name and then you can process them all
individually.

If all you're doing is setting items to visible, then just use
me.cmbBox1.visi ble=False

or you could use a boolean expression instead of just True or False.

Nov 13 '06 #2
On 13 Nov 2006 11:59:05 -0800, pi********@hotm ail.com wrote:

Perhaps you could write:
dim varControls as Variant = Array("cmbBox1" ,"cmbBox2","cmb Box3")
dim varControl as Variant
for each varControl in varControls
Me.Controls(var Control).Visibl e = False
next varControl

or if you KNOW the controls are numbered successively:
dim i as Integer
for i = 1 to 3
Me.Controls("cm bBox" & i).Visible = False
next i

There is also an interesting way to do it with additional parameters
passed to a function. I'll leave it up to you to read up on
ParamArray.

-Tom.
>
doodle wrote:
>access 97

can someone tell me the syntax for a with stement for multiple
controls?

pseudo (doesn't work)

With cmbBox1,cmbBox2 ,cmbBox3
.Visible = False
End With

-doodle

AFAIK, you can't do that. You can create a subroutine in your form
that accepts a control/control name and then you can process them all
individually .

If all you're doing is setting items to visible, then just use
me.cmbBox1.vis ible=False

or you could use a boolean expression instead of just True or False.
Nov 13 '06 #3
You don't appear to understand what the With statement is doing for you.

It provides a pointer to an object and cut down the overhead needed to
search for that object in all the objects you could be referring to.

So for your example you should be doing something like:-

With Me
With .cmbBox1
.Visible = False
End With

With .cmbBox2
.Visible = False
End With

With .cmbBox3
.Visible = False
End With
End With
--

Terry Kreft
"doodle" <AD******@mazak corp.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.com.. .
access 97

can someone tell me the syntax for a with stement for multiple
controls?

pseudo (doesn't work)

With cmbBox1,cmbBox2 ,cmbBox3
.Visible = False
End With

-doodle

Nov 14 '06 #4
Tom van Stiphout wrote:
On 13 Nov 2006 11:59:05 -0800, pi********@hotm ail.com wrote:

Perhaps you could write:
dim varControls as Variant = Array("cmbBox1" ,"cmbBox2","cmb Box3")
dim varControl as Variant
for each varControl in varControls
Me.Controls(var Control).Visibl e = False
next varControl

or if you KNOW the controls are numbered successively:
dim i as Integer
for i = 1 to 3
Me.Controls("cm bBox" & i).Visible = False
next i

There is also an interesting way to do it with additional parameters
passed to a function. I'll leave it up to you to read up on
ParamArray.

-Tom.
I like Tom's ideas. Here's a way to set the Visible property of all
comboboxes on an A97 form to False:

Dim ctl As Control

For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
With Controls(ctl.Na me)
.Visible = False
End With
End If
Next ctl

You can set the Tag property to a value and use that to control which
comboboxes disappear:

Dim ctl As Control

For Each ctl In Me.Controls
If ctl.ControlType = acComboBox Then
Select Case Me.Controls(ctl .Name).Tag
Case "HideMe":
With Controls(ctl.Na me)
.Visible = False
End With
End Select
End If
Next ctl

Try not to double up on the Tag property. You won't like where that
road leads. Ditto for OpenArgs.

Dim ctl As Control

For Each ctl In Me.Controls
If Right(ctl.Name, 9) = "Ephemeral" Then
If ctl.ControlType = acComboBox Then
With Controls(ctl.Na me)
.Visible = False
End With
End If
End If
Next ctl

sets the Visible property of comboboxes with a name ending in Ephemeral
to False.

It's also possible to use other combobox properties such as ForeColor,
which can have values that are just about indistinguishab le from each
other. Each shade variation can identify a group of controls. Groups
of control groups can use a color difference metric, say R,G and B
being within one unit of a particular color. I hope this helps.

James A. Fortune
CD********@Fort uneJames.com

A proverb is no proverb to you till life has illustrated it. -- John
Keats

Nov 15 '06 #5

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

Similar topics

68
4336
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I don't like the brackets.
3
4357
by: Jason Callas | last post by:
I have a stored procedure that runs as a step in a scheduled job. For some reason the job does not seem to finish when ran from the job but does fine when run from a window in SQL Query. I know the job is not working because the number of rows that are inserted into the table (see code) is considerably less than the manual runnning of it. I have included the code for the stored procedure, the output from the job, and the output from...
22
2724
by: nobody | last post by:
hello everybody, is there a way of creating an array with help of a function that would accept the name of this array as a parameter and then create global Array type variable of that name? so that for example the following code would work as well in browsers as under Windows Scripting Host: str = "tableA";
61
24457
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
27
2171
by: C Gillespie | last post by:
Dear All, Hopefully I have a simple problem. Basically, I just want to alter some text with JS. Here is some of my test code: <snip> <script type="text/javascript"> var tmp='a';
13
2552
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){}, my_meth2: function(){} }); to define new methods on the MyObj prototype object. Object.extend
0
2693
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it works for files larger than 8000 Bytes. If a file is less than 1000 Bytes I get the following message: Error message: --invalid input syntax for type oid: "\074\077......";
8
1786
by: Rasmus Kromann-Larsen | last post by:
The With Conundrum I'm currently writing a master thesis on (preparations for) static analysis of JavaScript, and after investigating the with statement, it only even more evident to me that the with statement is indeed bad. My initial thoughts on with were based on: http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/ I built some examples to investigate - and later try to "eliminate"
5
2026
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
2
20835
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use some of the tools provided on the command-line. If you hate the command line tools, get over it since you’re bound to be using them at some point in your career. All commands in Linux ARE case sensitive so capital letters are different from lowercase...
0
8701
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.