Tag Property

A

Ann

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]!.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
 
M

Mr. B

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 said:
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]!.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
[/QUOTE]
 
A

Ann

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]! = 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


[QUOTE="Mr. B"]
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


[QUOTE="Ann"]
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
[/QUOTE][/QUOTE]
 
N

NG

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
 
A

Ann

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 said:
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 said:
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?
 
A

Ann

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 said:
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 said:
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 said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top