[AccessD] IF ...... ELSEIF

Pedro Janssen pedro at plex.nl
Tue Mar 25 13:16:58 CST 2003


Thank You William and Jim.
I now the SelectCase statement. But i still find it a lot of work.
I hoped to receive a reaction like Jim did.
I will try this and hopefully it works.

Greetings 

Pedro Janssen
  ----- Original Message ----- 
  From: Jim DeMarco 
  To: accessd at databaseadvisors.com 
  Sent: Tuesday, March 25, 2003 2:25 PM
  Subject: RE: [AccessD] IF ...... ELSEIF


  Pedro,
   
  Since you seem to be following a control naming/numbering scheme try something like this (untested, written in notepad; watch for wrapping):
   
  Dim blnGetOut As Boolean
   
  for i = 1 to 6     'change to the number of chbx items (x = numeric value)

    for j = 0 to 1     'change to the number of letters (suffix) to iterate through - 1 (as in chb1A or chb1B)
      if controls("chb" & i) = true and controls("chb" & j & chr(65 + j)) = true
        prps.Item("Name").Value = Nz(Me.Controls("txtName" & i)
        prps.Item("Adress").Value = NZ(Me.conrols("txtAddress" & i)
        prps.Item("Part" & i & chr(65 + j)).Value = Nz(Me.controls("txtPart" & i & chr(65 + j))
        prps.Item("ZkFonds" & i & chr(65 + j)).Value = Nz(Me.controls("txtZkfonds" & i & chr(65 + j))    
        blnGetOut = True
      end if
    next j
   
    If blnGetOut = True Then Exit For
  next i
   
   
  HTH, 

  Jim DeMarco 
  Director of Product Development 
  HealthSource/Hudson Health Plan 

    -----Original Message-----
    From: Pedro Janssen [mailto:pedro at plex.nl]
    Sent: Monday, March 24, 2003 5:08 PM
    To: AccessD at databaseadvisors.com
    Subject: [AccessD] IF ...... ELSEIF


    Hello Group,

    The code below is a part of a code that i use to make 
    wordletters with data from access2K.

     If chb1 = True and chb1A = True then
        prps.Item("Name").Value = Nz(Me![txtName1])
        prps.Item("Adress").Value = Nz(Me![txtAddress1])
        prps.Item("Part1A").Value = Nz(Me![txtPart1A])
        prps.Item("ZkFonds1A").Value = Nz(Me![txtZkFonds1A])

       ElseIf chb1 = True and chb1B = True then
        prps.Item("Name").Value = Nz(Me![txtName1])
        prps.Item("Adress").Value = Nz(Me![txtAddress1])
        prps.Item("Part1B").Value = Nz(Me![txtPart1B])
        prps.Item("ZkFonds1B").Value = Nz(Me![txtZkFonds1B])
     
    ElseIf  chb2 = True and chb2A = True then 
        prps.Item("Name").Value = Nz(Me![txtName2])
        prps.Item("Adress").Value = Nz(Me![txtAddress2])
        prps.Item("Part2A").Value = Nz(Me![txtPart2A])
        prps.Item("ZkFonds2A").Value = Nz(Me![txtZkFonds2A]) 

    ElseIf chb2 = True and chb2B = True then 
        prps.Item("Name").Value = Nz(Me![txtName2])
        prps.Item("Adress").Value = Nz(Me![txtAddress2])
        prps.Item("Part2B").Value = Nz(Me![txtPart2B])
        prps.Item("ZkFonds2B").Value = Nz(Me![txtZkFonds2B])
     
    End If
     
     
    because i have lots of fields and lots of checkboxes its a hell
    of a job to type, or copy/paste and change all this.
    I know the code below isn't working, but is there a way to modifie
    the code to something like


     If chb1 = True then
        prps.Item("Name").Value = Nz(Me![txtName1])
        prps.Item("Adress").Value = Nz(Me![txtAddress1])
     
    AND chb2A = True Then
        prps.Item("Part1A").Value = Nz(Me![txtPart1A])
        prps.Item("ZkFonds1A").Value = Nz(Me![txtZkFonds1A])
    AND chb2B = True Then
        prps.Item("Part1B").Value = Nz(Me![txtPart1B])
        prps.Item("ZkFonds1B").Value = Nz(Me![txtZkFonds1B])
     

    ElseIf If chb2 = True then 
        prps.Item("Name").Value = Nz(Me![txtName2])
        prps.Item("Adress").Value = Nz(Me![txtAddress2])
     
    AND chb2A = True Then
        prps.Item("Part2A").Value = Nz(Me![txtPart2A])
        prps.Item("ZkFonds2A").Value = Nz(Me![txtZkFonds2A])
    AND chb2B = True Then
        prps.Item("Part2B").Value = Nz(Me![txtPart2B])
        prps.Item("ZkFonds2B").Value = Nz(Me![txtZkFonds2B])
     
    End If
     
    TIA
     
    Pedro Janssen
     


  ***********************************************************************************
  "This electronic message is intended to be for the use only of the named recipient, and may contain information from HealthSource/Hudson Health Plan (HS/HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HS/HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You".
  ***********************************************************************************



------------------------------------------------------------------------------


  _______________________________________________
  AccessD mailing list
  AccessD at databaseadvisors.com
  http://databaseadvisors.com/mailman/listinfo/accessd
  Website: http://www.databaseadvisors.com

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


More information about the AccessD mailing list