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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Assign Form Controls to a Group



 
 
Thread Tools Display Modes
  #1  
Old September 6th, 2007, 04:44 PM posted to microsoft.public.access.forms
PJFry
external usenet poster
 
Posts: 148
Default Assign Form Controls to a Group

I am working with a form that has some client-specific fields. Client X has
three bound controls, a,b and c. Client Y has two bound controls, e and f.
Right now, I show or hide the controls with an OnCurrent event.

If Me.txtClient = "X" Then
Me.cboStatus.Visible = True
me.lblStatus.Visible = True
'etc.
Else
Me.cboStatus.Visible = False
me.lblStatus.Visible = False
'etc.
End If

Can I group controls a,b and c? I imagine it would looks something like this:
If Me.txtClient = "X" Then
ClientX.Visible = True
Else
ClientX.Visible = False
End If

Where ClientX represents all controls associated with that specific client.

Can this be done?
If not, any suggestions to streamline the process? I have about 10 clients
that all require specific fields. To reduce confusion, I only want fields
relevant to a client to be shown.

Thanks!
PJ

  #2  
Old September 6th, 2007, 08:30 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Assign Form Controls to a Group

Let me see if I get this right. You have controls designated to clients?
(textfields). In that case I assume that controls 1 and 2 and 3 belong to the
first client etc. If so you might think of using the tag as a place to put
the clients name and then refer to that via code. Something like:

dim ctl as control
for each ctl in me
if ctl.tag ="ClientX" then
ctl.visible=true
else
ctl.visible=false
end if
next

Or do you mean something else?

hth

--
Maurice Ausum


"PJFry" wrote:

I am working with a form that has some client-specific fields. Client X has
three bound controls, a,b and c. Client Y has two bound controls, e and f.
Right now, I show or hide the controls with an OnCurrent event.

If Me.txtClient = "X" Then
Me.cboStatus.Visible = True
me.lblStatus.Visible = True
'etc.
Else
Me.cboStatus.Visible = False
me.lblStatus.Visible = False
'etc.
End If

Can I group controls a,b and c? I imagine it would looks something like this:
If Me.txtClient = "X" Then
ClientX.Visible = True
Else
ClientX.Visible = False
End If

Where ClientX represents all controls associated with that specific client.

Can this be done?
If not, any suggestions to streamline the process? I have about 10 clients
that all require specific fields. To reduce confusion, I only want fields
relevant to a client to be shown.

Thanks!
PJ

  #3  
Old September 6th, 2007, 08:54 PM posted to microsoft.public.access.forms
UpRider
external usenet poster
 
Posts: 259
Default Assign Form Controls to a Group

PJ, I don't know of a way to 'group' controls like that.

The closest I can figure would be to create one function and then use
a straightforward and easy to understand 'select case' like this in the
form_current event:

select case txtClient
case "X"
call fcnHideControls
controlX.visible = true
lblxxx.visible = true
case "Y"
call fcnHideControls
controlY.visible = true
lblyyy.visible = true
etc
case else
msgbox "Unknown Client"
end select

Function fcnHideControls()
'code here to set ALL client controls.visible = false
end function

UpRider

"PJFry" wrote in message
...
I am working with a form that has some client-specific fields. Client X
has
three bound controls, a,b and c. Client Y has two bound controls, e and
f.
Right now, I show or hide the controls with an OnCurrent event.

If Me.txtClient = "X" Then
Me.cboStatus.Visible = True
me.lblStatus.Visible = True
'etc.
Else
Me.cboStatus.Visible = False
me.lblStatus.Visible = False
'etc.
End If

Can I group controls a,b and c? I imagine it would looks something like
this:
If Me.txtClient = "X" Then
ClientX.Visible = True
Else
ClientX.Visible = False
End If

Where ClientX represents all controls associated with that specific
client.

Can this be done?
If not, any suggestions to streamline the process? I have about 10
clients
that all require specific fields. To reduce confusion, I only want fields
relevant to a client to be shown.

Thanks!
PJ



  #4  
Old September 6th, 2007, 08:58 PM posted to microsoft.public.access.forms
PJFry
external usenet poster
 
Posts: 148
Default Assign Form Controls to a Group

I think you have it, though I am not familiar with tags.

A more through description would be this:
Create a 'group' controls named ClientX
Members of ClientX a
Me.cboStatus
Me.lblStatus
Me.cboProgress
Me.lblProgress
Me.txtAddress
Me.lblAddress

Then, if I change the properties of ClientX, it would affect all six
controls. I.e.

ClientX.Visible = False
would be the same thing as
Me.cboStatus.Visible = False
Me.lblStatus.Visible = False
Me.cboProgress.Visible = False
Me.lblProgress.Visible = False
Me.txtAddress.Visible = False
Me.lblAddress.Visible = False

This is a like a With...End, except I am doing one thing to multiple
controls as opposed to multiple things to one control.

I hope that makes sense...

So if all of the above is what you mean, then yes, you have it right!



"Maurice" wrote:

Let me see if I get this right. You have controls designated to clients?
(textfields). In that case I assume that controls 1 and 2 and 3 belong to the
first client etc. If so you might think of using the tag as a place to put
the clients name and then refer to that via code. Something like:

dim ctl as control
for each ctl in me
if ctl.tag ="ClientX" then
ctl.visible=true
else
ctl.visible=false
end if
next

Or do you mean something else?

hth

--
Maurice Ausum


"PJFry" wrote:

I am working with a form that has some client-specific fields. Client X has
three bound controls, a,b and c. Client Y has two bound controls, e and f.
Right now, I show or hide the controls with an OnCurrent event.

If Me.txtClient = "X" Then
Me.cboStatus.Visible = True
me.lblStatus.Visible = True
'etc.
Else
Me.cboStatus.Visible = False
me.lblStatus.Visible = False
'etc.
End If

Can I group controls a,b and c? I imagine it would looks something like this:
If Me.txtClient = "X" Then
ClientX.Visible = True
Else
ClientX.Visible = False
End If

Where ClientX represents all controls associated with that specific client.

Can this be done?
If not, any suggestions to streamline the process? I have about 10 clients
that all require specific fields. To reduce confusion, I only want fields
relevant to a client to be shown.

Thanks!
PJ

 




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


All times are GMT +1. The time now is 11:07 PM.


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