Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setvalue action in macro

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
-([BoneMar]+[Brain]+[Bone]+[Liver]+IIf([LymNodRgnl]=True Or [LymNodDist]=True,-1,0)+[Peritoneum]+[Pleura]+IIf([SknSftRgnl]=True Or [SknSftDist]=True,-1,0)+Not IsNull([OtherSpecify1])+Not IsNull([OtherSpecify2])+Not IsNull([OtherSpecify3]))

is some code i have in a macro which enters the sum of the number of times a) check boxes are affirmed and/or b) text is entered into three text box controls.

it doesn't work as it should.

before arriving at the code above, it looked like this:

-([BoneMar]+[Brain]+[Bone]+[Liver]+IIf([LymNodRgnl]=True Or [LymNodDist]=True,-1,0)+[Peritoneum]+[Pleura]+IIf([SknSftRgnl]=True Or [SknSftDist]=True,-1,0)+Not IsNull([OtherSpecify]))

which worked; but i needed to have three 'Other Specify' fields so i created two more and appended the extension 1, 2, and 3 to each of the controls' names and added their existence to the code.

at this point, if we ignore the checkboxes and focus on the fields beginning with 'OtherSpecify' and ending in either 1, 2 or 3, when the command button which actuates the macro that sets the value in a field (called 'Number of Metastatic Sites') is used, it seems to only detect the presence of nonblank values of 'OtherSpecify1'!!??

any thoughts?

 
IIf([LymNodRgnl]=True Or [LymNodDist]=True,-1,0)
can be replaced by
([LymNodRgnl] Or [LymNodDist])

IIf([SknSftRgnl]=True Or [SknSftDist]=True,-1,0)
can be replaced by
([SknSftRgnl] Or [SknSftDist])

Not IsNull([OtherSpecify])) returns True if OtherSpecify is not Null and False if is null. Try deleting Not IsNull. That will return the value of the option group (if that's what it is)

HTH




[pipe]
Daniel Vlas
Systems Consultant

 
i think there was a misunderstanding wrt the issue.

the top batch of code is the one that the lower one got revised to be, in order to handle the need to have three free text fields/controls (not option groups, just text controls into which a user enters characters and spaces) which would enter into the total. the idea's that if the user enters text into any of the three OtherSpecify1 or 2 or 3 text fields that that should be counted in the total, otherwise the response should be ignored (treated as a zero) for the purposes of the computation of the sum.

the bottom most code worked before it became necessary to add the additional pair of 'clones' of OtherSpecify.


the mystery continues...
 
You could try the following:

+Nz([OtherSpecify1],0)+(Nz([OtherSpecify2],0)+Nz([OtherSpecify3],0)



Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
hi all:

after trying a few permutations, the one that i found worked was:

-([BoneMar]+[Brain]+[Bone]+[Liver]+IIf([LymNodRgnl] Or [LymNodDist]=True,-1,0)+[Peritoneum]+[Pleura]+IIf([SknSftRgnl] Or [SknSftDist]=True,-1,0)+IIf(IsNull([OtherSpecify1]),0,-1)+IIf(IsNull([OtherSpecify2]),0,-1)+IIf(IsNull([OtherSpecify3]),0,-1))

for some reason, when i use yours instead, it can't seem to parse it, but anyway, thanks a bunch.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top