[AccessD] select more then one

Pedro Janssen pedro at plex.nl
Sun Aug 24 03:59:32 CDT 2003


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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030824/8d5a639f/attachment-0001.html>


More information about the AccessD mailing list