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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Tag Property
I'm sorry if this shows up multiple places. I tried to enter it into the
Programming group put it does not show up so I am trying somewhere else. First let me say I'm not a programmer so I appreciate any help that is offered. Someone has helped me with the code below. Each tag property on each control has either a 10 for Low Risk, 100 for Medium Risk and 1000 for High Risk. Each control has an AfterUpdate event that will call the sub Risk. This then will populate the txtRisk control which will put the appropriate checkmark in an option group checkbox. The problem is that they are all high because it's added all of them not just those that are checked. How do I get it to only add the value in the tag property to the RiskValue if the checkbox is checked? Thank you again for any help I receive. Public Sub Risk() Dim RiskValue As Integer RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Name].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![DOB].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Phone].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![email].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Med Record].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![HP Beneficiary].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Account].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Certificate].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![License].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Full Face Photo].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Vehicle].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Web URL].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Internet Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Finger Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Voice Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Health Info].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Other].Tag) If RiskValue 1000 And RiskValue 8480 Then txtRisk = 1 End If If RiskValue 100 And RiskValue 480 Then txtRisk = 2 End If If RiskValue 0 And RiskValue 80 Then txtRisk = 3 End If End Sub |
#2
|
|||
|
|||
Tag Property
Ann,
You will need to modify each line of the code that is adding the value so that it will evaluate the condition of the checkbox associated with the text box. For example: If [Forms]![Main]![NameOfCheckBox] = true then RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) end if You will need to substitue the "NameOfCheckBox" in the code above with the actual name of the checkbox associated with the "SSN" field. You will also need to make this type of change for each of the fields represented by one of the lines of code. ----- HTH Mr. B http://www.askdoctoraccess.com/ Doctor Access Downloads Page: http://www.askdoctoraccess.com/DownloadPage.htm "Ann" wrote: I'm sorry if this shows up multiple places. I tried to enter it into the Programming group put it does not show up so I am trying somewhere else. First let me say I'm not a programmer so I appreciate any help that is offered. Someone has helped me with the code below. Each tag property on each control has either a 10 for Low Risk, 100 for Medium Risk and 1000 for High Risk. Each control has an AfterUpdate event that will call the sub Risk. This then will populate the txtRisk control which will put the appropriate checkmark in an option group checkbox. The problem is that they are all high because it's added all of them not just those that are checked. How do I get it to only add the value in the tag property to the RiskValue if the checkbox is checked? Thank you again for any help I receive. Public Sub Risk() Dim RiskValue As Integer RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Name].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![DOB].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Phone].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![email].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Med Record].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![HP Beneficiary].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Account].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Certificate].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![License].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Full Face Photo].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Vehicle].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Web URL].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Internet Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Finger Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Voice Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Health Info].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Other].Tag) If RiskValue 1000 And RiskValue 8480 Then txtRisk = 1 End If If RiskValue 100 And RiskValue 480 Then txtRisk = 2 End If If RiskValue 0 And RiskValue 80 Then txtRisk = 3 End If End Sub |
#3
|
|||
|
|||
Tag Property
Hi,
I made the changes but nothing happens. The checkboxes are checked but nothing appears in the txtRisk box. Here is how it looks now. I something typed incorrectly? Public Sub Risk() Dim RiskValue As Integer If [Forms]![Main]![SSN] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) If [Forms]![Main]![Name] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Name].Tag) If [Forms]![Main]![DOB] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![DOB].Tag) If [Forms]![Main]![Address] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Address].Tag) If [Forms]![Main]![Phone] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Phone].Tag) If [Forms]![Main]![email] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![email].Tag) If [Forms]![Main]![Med Record] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Med Record].Tag) If [Forms]![Main]![HP Beneficiary] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![HP Beneficiary].Tag) If [Forms]![Main]![Account] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Account].Tag) If [Forms]![Main]![Certificate] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Certificate].Tag) If [Forms]![Main]![License] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![License].Tag) If [Forms]![Main]![Full Face Photo] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Full Face Photo].Tag) If [Forms]![Main]![Vehicle] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Vehicle].Tag) If [Forms]![Main]![Web URL] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Web URL].Tag) If [Forms]![Main]![Internet Address] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Internet Address].Tag) If [Forms]![Main]![Finger Print] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Finger Print].Tag) If [Forms]![Main]![Voice Print] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Voice Print].Tag) If [Forms]![Main]![Health Info] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Health Info].Tag) If [Forms]![Main]![Other] = True Then RiskValue = RiskValue + CInt([Forms]![Main]![Other].Tag) If RiskValue 1000 And RiskValue 8480 Then txtRisk = 1 End If If RiskValue 100 And RiskValue 480 Then txtRisk = 2 End If If RiskValue 0 And RiskValue 80 Then txtRisk = 3 End If End Sub "Mr. B" wrote: Ann, You will need to modify each line of the code that is adding the value so that it will evaluate the condition of the checkbox associated with the text box. For example: If [Forms]![Main]![NameOfCheckBox] = true then RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) end if You will need to substitue the "NameOfCheckBox" in the code above with the actual name of the checkbox associated with the "SSN" field. You will also need to make this type of change for each of the fields represented by one of the lines of code. ----- HTH Mr. B http://www.askdoctoraccess.com/ Doctor Access Downloads Page: http://www.askdoctoraccess.com/DownloadPage.htm "Ann" wrote: I'm sorry if this shows up multiple places. I tried to enter it into the Programming group put it does not show up so I am trying somewhere else. First let me say I'm not a programmer so I appreciate any help that is offered. Someone has helped me with the code below. Each tag property on each control has either a 10 for Low Risk, 100 for Medium Risk and 1000 for High Risk. Each control has an AfterUpdate event that will call the sub Risk. This then will populate the txtRisk control which will put the appropriate checkmark in an option group checkbox. The problem is that they are all high because it's added all of them not just those that are checked. How do I get it to only add the value in the tag property to the RiskValue if the checkbox is checked? Thank you again for any help I receive. Public Sub Risk() Dim RiskValue As Integer RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Name].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![DOB].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Phone].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![email].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Med Record].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![HP Beneficiary].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Account].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Certificate].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![License].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Full Face Photo].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Vehicle].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Web URL].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Internet Address].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Finger Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Voice Print].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Health Info].Tag) RiskValue = RiskValue + CInt([Forms]![Main]![Other].Tag) If RiskValue 1000 And RiskValue 8480 Then txtRisk = 1 End If If RiskValue 100 And RiskValue 480 Then txtRisk = 2 End If If RiskValue 0 And RiskValue 80 Then txtRisk = 3 End If End Sub |
#4
|
|||
|
|||
Tag Property
Hi Ann
Are you sure that [Forms]![Main]![Name] or [Forms]![Main]![SSN] are the names of the checkboxes? The code says: if [forms]![Main]![NameOfTheCheckbox] then RiskValue = RiskValue + CInt([Forms]![Main]![NameOftheCorrespondingFieldWithTheTag].Tag) So check that in the first part you use the names of the checkboxes. kind regards NG "Ann" wrote: Hi, I made the changes but nothing happens. The checkboxes are checked but nothing appears in the txtRisk box. Here is how it looks now. I something typed incorrectly? |
#5
|
|||
|
|||
Tag Property
Instead of If [Forms]![Main]![NameOfCheckBox] = true then RiskValue =
RiskValue + CInt([Forms]![Main]![SSN].Tag) end if I had to type [Forms]![Main]![NameOfCheckBox].Value = -1 and add = to the and then everything worked. I still have one problem though because if I click off a checkbox without picking a different box I'm stuck with the risk that was originally assigned. How do I get them to not be counted if the checkbox is unchecked? "NG" wrote: Hi Ann Are you sure that [Forms]![Main]![Name] or [Forms]![Main]![SSN] are the names of the checkboxes? The code says: if [forms]![Main]![NameOfTheCheckbox] then RiskValue = RiskValue + CInt([Forms]![Main]![NameOftheCorrespondingFieldWithTheTag].Tag) So check that in the first part you use the names of the checkboxes. kind regards NG "Ann" wrote: Hi, I made the changes but nothing happens. The checkboxes are checked but nothing appears in the txtRisk box. Here is how it looks now. I something typed incorrectly? |
#6
|
|||
|
|||
Tag Property
I thing I got it. I changed the lowest risk to be =1 and then added a few
more lines if the risk is 0. Since that's the default for the option group it turns off the previously chosen checkbox. If RiskValue = 1 And RiskValue = 80 Then txtRisk = 3 End If If RiskValue = 0 Then txtRisk = 0 End If "Ann" wrote: Instead of If [Forms]![Main]![NameOfCheckBox] = true then RiskValue = RiskValue + CInt([Forms]![Main]![SSN].Tag) end if I had to type [Forms]![Main]![NameOfCheckBox].Value = -1 and add = to the and then everything worked. I still have one problem though because if I click off a checkbox without picking a different box I'm stuck with the risk that was originally assigned. How do I get them to not be counted if the checkbox is unchecked? "NG" wrote: Hi Ann Are you sure that [Forms]![Main]![Name] or [Forms]![Main]![SSN] are the names of the checkboxes? The code says: if [forms]![Main]![NameOfTheCheckbox] then RiskValue = RiskValue + CInt([Forms]![Main]![NameOftheCorrespondingFieldWithTheTag].Tag) So check that in the first part you use the names of the checkboxes. kind regards NG "Ann" wrote: Hi, I made the changes but nothing happens. The checkboxes are checked but nothing appears in the txtRisk box. Here is how it looks now. I something typed incorrectly? |
Thread Tools | |
Display Modes | |
|
|