[AccessD] select more then one

Gustav Brock gustav at cactus.dk
Sun Aug 24 04:35:02 CDT 2003


Hi Pedro

Tough vacation/holiday?

If you read the code there is an "inner".
There's also an "i" ..

What to do is left to you as a small after-vacation-exercise!

Also, _always_ state

  Option Explicit

in the declarations section of every code module.

/gustav


> Hello Jim and rest of the group,

> sorry for the late responce. I have been on holliday.

> When i use the code you gave me, i get an compile error: Sub or Function not defined.  Controls is selected.
> I can't find the missing reference, or is there someting else wrong

> Also i don't understand why jou use: Dim inner As Integer. There isn't an: inner, in the code

> Can You help me.

> TIA

> Pedro Janssen
>   ----- Original Message ----- 
>   From: Jim DeMarco 
>   To: Access Developers discussion and problem solving 
>   Sent: Friday, August 01, 2003 2:08 PM
>   Subject: RE: [AccessD] select more then one


>   How about something like this:
>   <code>
>   Function ShowHide(ctl as Control)
>   Dim inner As Integer
>   Dim outer as Integer
>   Dim ShowIndex As Integer
>   ShowIndex = Right(ctl.Name, 1)
>   For  outer = 1 To 5
>     For i = 1 To 26
>         If outer = Cint(ShowIndex) Then
>           Controls("Field" & ShowIndex & "_" & CStr(i)).Visible = True
>         Else
>           Controls("Field" & outer & "_" & CStr(i)).Visible = False
>         End If
>         'or
>           Controls("Field" & outer & "_" & CStr(i)).Visible = (outer = Cint(ShowIndex))
>     Next inner
>   Next outer
   
>   End Function
>   </code>
   
>   or use this simplified version to replace the If block:
   
>   <snip>
>           Controls("Field" & outer & "_" & CStr(i)).Visible = (outer = Cint(ShowIndex))
>   </snip>
   
>   Assuming chbProductcode1 through 5 are controls call this function from each of the (chbProductcode1) click or change event passing in the name of the calling control:
   
>   <usage>
>   Sub chbProductcode1_Click()
>     ShowHide(chbProductcode1)
>   End Sub
>   </usage>
>   HTH, 

>   Jim DeMarco 
>   Director of Product Development 
>   HealthSource/Hudson Health Plan 



More information about the AccessD mailing list