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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dislay checked check box on report based on string value 1

Status
Not open for further replies.

mibeach7

MIS
Jun 18, 2003
35
US
Greetings,

I am reading in a field from a database that has a value such as "1|3|4" or "2|7|4|9"

What I need to do is have several check boxes on a report and if the string has a 3, then check box #3 will be visible and checked on the report, and the same for check box #1 it will also be visible and checked as is check box #4 for the first string value example. Otherwise, if the number 3 is not in the string, then chekbox #3 will not be visible.

How do I read in a pipe delimited string like this.
How do I set the value of the checkbox to be visible and checked if the strings reads a 3 or 4 or 1.

One more question, why when I grad the resize handles on the check box does the visible checkbox stay the same size. It does not grow bigger with the object resizing.

Thanks for your help,
Ron

 
Hi!

I think I'd start with the Split function, to delimit the string into an array:

[tt]dim strArr() as string
strArr=split(<your form reference>,"|")[/tt]

Then, if the chekcboxes are named chk1 thru chkN (highest number), some kind of "controls array" could be used:

[tt]dim lCounter as long
for lCounter=0 to ubound(strArr)
if isnumeric(strArr(lCounter)) then
me("chk" & clng(strArr(lCounter))).visible=true
end if
next lCounter[/tt]

- this would require some more error trapping, place it in the on format event of the section where the controls reside.

I'm assuming here that the checkboxes are for display purpose only, then in design view, set the controlsource to -1 (true) and visible No. To have larger checkboxes, create you own, for instance as described in mstrmage1768's faq faq702-2255.


Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top