A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Control Arrays



 
 
Thread Tools Display Modes
  #1  
Old November 27th, 2005, 12:11 PM posted to microsoft.public.access.tablesdbdesign
external usenet poster
 
Posts: n/a
Default Control Arrays

control arrays can be used in VB which reduces amount of code that needs to
be entered. is it possible to use the same concept in MS Access which has VB,
because the controls don't have "Index" in their properties and Access does
not allow the user to use the same name for more than one control.
if control arrays can't be used is there anything else that can be used
instead?
thanks.
  #2  
Old November 27th, 2005, 12:45 PM posted to microsoft.public.access.tablesdbdesign
external usenet poster
 
Posts: n/a
Default Control Arrays

It's possible to use a naming convention for your controls, and simulate
control arrays that way.

For example, if you've got a number of checkboxes, you could name them
chkBox1, chkBox2, chkBox3 and so on. You can then refer to each of them in a
loop like:

Dim ctlCurr As Control
Dim intLoop As Integer

For intLoop = 1 to 10
Set ctlCurr = Me.Controls("chkBox" & intLoop)
' Use ctlCurr to refer to the "current" control
Next intLoop

As to having event procedures and the like, you can write a generic routine
that uses Screen.ActiveControl to determine which control is active, and put
that generic routine as the Event Procedure for all of the controls in the
pseudo control array.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Pramatha" wrote in message
...
control arrays can be used in VB which reduces amount of code that needs
to
be entered. is it possible to use the same concept in MS Access which has
VB,
because the controls don't have "Index" in their properties and Access
does
not allow the user to use the same name for more than one control.
if control arrays can't be used is there anything else that can be used
instead?
thanks.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Control does not refresh Snowsride Using Forms 1 October 4th, 2005 02:06 PM
Data Entry Mode bdehning Using Forms 17 November 22nd, 2004 04:49 PM
How can I move the focus to a control on a subform? Brandon General Discussion 7 July 17th, 2004 01:39 AM
Access Calendar lost General Discussion 2 July 7th, 2004 04:58 AM
AfterUpdate event of Calendar Control in Access 2000 not firing as expected? Gary Using Forms 3 July 2nd, 2004 07:53 PM


All times are GMT +1. The time now is 08:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.