[AccessD] select more then one

Marcus, Scott (GEAE, Contractor) scott.marcus at ae.ge.com
Fri Aug 1 07:00:03 CDT 2003


Pedro,
 
Don't be afraid to ask...
 
Dim intCheckBox as integer
Dim intField as integer
Dim bolVisible as Boolean
 
For intCheckBox = 1 to 10 ' Change 10 to the number of Product Code Check
Boxes on your form
    bolVisible = Me("chbProductcode" & intCheckBox)
    For intField = 1 to 26
        Me("fields " & intCheckBox & "_" & intField).Visible = bolVisible
    Next intField
Next intCheckBox
 
Scott
 
-----Original Message-----
From: Pedro Janssen [mailto:pedro at plex.nl]
Sent: Thursday, July 31, 2003 5:16 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] select more then one



Hello Scott an the rest of the group
 
i have one more question, if you don't mind. Its not that i didn't wanted to
give you the whole picture, i wanted to solve this problem myself in the
code you suggested (for learning reasons), but i didn't solve it. It was to
difficult for me.
 
I would like that:
when chbProductcode1 = true, fields 1_1 until fields 1_26 are visible, when
chbProductcode1 = false, fields 1_1 until fields 1_26 are not visible. 
when chbProductcode2 = true, fields 2_1 until fields 2_26 are visible, when
chbProductcode2 = false, fields 2_1 until fields 2_26 are not visible.
when chbProductcode3 = true, fields 3_1 until fields 3_26 are visible, when
chbProductcode3 = false, fields 3_1 until fields 3_26 are not visible
etc for 4 and 5
 
TIA
 
Pedro Janssen
 
 
 
----- Original Message ----- 

From: Marcus,  <mailto:scott.marcus at ae.ge.com> Scott (GEAE, Contractor) 
To: 'Access Developers discussion and  <mailto:accessd at databaseadvisors.com>
problem solving' 
Sent: Monday, July 28, 2003 2:10 PM
Subject: RE: [AccessD] select more then one

Pedro,
 
We should really know the whole picture so that the code doesn't need to be
rewritten each time you give us a new piece of information. Anyway, this
should get you there (with some minor tweaks). Watch out for line wrapping
in the e-mail...
 
Dim strNumbers As String, strNumber As String
Dim intLoc As Integer, intNumber As Integer
Dim bolFound As Boolean
 
bolFound = False
For intNumber = 1 To 5 ' Build a string that represents each checked Product
Code
    If Me("chbProductCode" & intNumber) = True Then
        strNumbers = strNumbers & intNumber & ";"
        bolFound = True
    End If
Next intNumber
 
If bolFound = True Then
    strNumbers = Left(strNumbers, Len(strNumbers) - 1)
End If
 
While bolFound = True
    intLoc = InStr(strNumbers, ";")

    If intLoc > 0 Then ' see if the are more than one to deal with
        ' There are more than one so, parse out individual numbers
        strNumber = Left(strNumbers, intLoc - 1)
        strNumbers = Right(strNumbers, Len(strNumbers) - intLoc)
    Else
        ' This is the last one
        strNumber = strNumbers
        bolFound = False
    End If

    .Item("ProductCode" & strNumber).Value = Nz(Me("txtProductCode" & _
        strNumber))
    .Item("Number" & strNumber).Value = Nz(Me![txtNumber])
 
    'You need to change this for what you are doing
    If chbA1 = True Then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c16"))
    ElseIf chbA2 = True Then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c17"))
    ElseIf chbA3 = True Then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c18"))
    ElseIf chbUitz1 = True Then
        .Item("Number" & strNumber).Value = Nz(Me("txtUitz" & _
            strNumber & "Number"))
        .Item("Price" & strNumber).Value = Nz(Me("txtUitz" & _
            strNumber & "Price"))
    End If
Wend

 
Scott
 

-----Original Message-----
From: Pedro Janssen [mailto:pedro at plex.nl]
Sent: Saturday, July 26, 2003 10:22 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] select more then one


Hello Group,
 
with the code below i get as result: One  Produktcode,  One number and  One
price depending on which checkboxProduktcode is selected.
 
Is there a way to change this code so that i could select more then one
checkboxProduktcode (still only one of the chbA1, chbA2, chbA3 or
chbUitz1can be selected) and that the outcome would be the selected
produktcodes with there numbers and prices
 
TIA
 
Pedro Janssen
 
 
 
 
 
Dim strNumber as String
Dim bolFound as Boolean

bolFound = False
If chbProductCode1 = true then
    strNumber = "1"
    bolFound = True
ElseIf chbProductCode2 = true then
    strNumber = "2"
    bolFound = True
ElseIf chbProductCode3 = true then
    strNumber = "3"
    bolFound = True
ElseIf chbProductCode4 = true then
    strNumber = "4"
    bolFound = True
ElseIf chbProductCode5 = true then
    strNumber = "5"
    bolFound = True

EndIf

If bolFound = True then
    .Item("ProductCode" & strNumber).Value = Nz(Me("txtProductCode" & _
        strNumber))
    .Item("Number" & strNumber).Value = Nz(Me![txtNumber])
    
    If chbA1 = True then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c16"))
    ElseIf chbA2 = True then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c17"))
    ElseIf chbA3 = True then
        .Item("Price" & strNumber).Value = Nz(Me("txt" & _
            strNumber & "c18"))
    ElseIf chbUitz1 = True then
        .Item("Number" & strNumber).Value = Nz(Me("txtUitz" & _
            strNumber & "Number"))
        .Item("Price" & strNumber).Value = Nz(Me("txtUitz" & _
            strNumber & "Price"))
    End If
End If




  _____  




_______________________________________________
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/20030801/691a8a77/attachment.html>


More information about the AccessD mailing list