Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-02-2018, 11:15 AM   #1
buzzbait9
Newly Registered User
 
Join Date: May 2015
Posts: 18
Thanks: 6
Thanked 0 Times in 0 Posts
buzzbait9 is on a distinguished road
Choose checkbox by record value then loop rows in report

Hello Ya'll

First Part: I have been trying to use to a record value and choose a checkbox. Sat, Unsat, N/A are the 3 boxes. I used the control name and tried Nesting first and then made it simple.

If a.Value = 1 Then
Check68 = True
Check69 = False
Check70 = False
End If
If a.Value = 2 Then
Check68 = False
Check69 = True
Check70 = False
End If
If a.Value = 3 Then
Check68 = False
Check69 = False
Check70 = True

When the report comes up, the check boxes are all empty.

Second Part: Even if the checkboxes were full, I'm having trouble looping through each page of the report. Each row of the query ends a page and the next page starts on a new row. The new record has to default the checkboxes back to 0 so the values can change for the next page. Of course like the above, I tried the easiest way but I wasn't successful.

Dim rst As Recordset, i As Integer

Set rst = Me.RecordsetClone
i = 0
rst.MoveFirst
Do While Not rst.EOF
i = i + 1
rst.Edit
rst![SelectServComplete] = Null
rst![a] = Null
rst![b] = Null
rst![c] = Null
rst![d] = Null
rst![e] = Null
rst![f] = Null
rst![g] = Null
rst![h] = Null
rst![i] = Null
rst![j] = Null
rst![k] = Null
rst![l] = Null
rst![m] = Null
rst.Update
rst.MoveNext
Loop
rst.Close
Set rst = Nothing

Is there hope for me?

Thank you

buzzbait9 is offline   Reply With Quote
Old 08-02-2018, 11:31 AM   #2
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 819
Thanks: 0
Thanked 185 Times in 185 Posts
June7 will become famous soon enough
Re: Choose checkbox by record value then loop rows in report

Can't use VBA to directly set values of controls on report. Use expression in ControlSource.

Check68:
= [a]=1

Check69:
= [a]=2

Check70:
= [a]=3

Otherwise, ControlSource can call a VBA custom function that returns a value.
=MyFunction(argument parameters if required by function)

Last edited by June7; 08-02-2018 at 11:37 AM.
June7 is offline   Reply With Quote
Old 08-11-2018, 03:53 AM   #3
buzzbait9
Newly Registered User
 
Join Date: May 2015
Posts: 18
Thanks: 6
Thanked 0 Times in 0 Posts
buzzbait9 is on a distinguished road
Re: Choose checkbox by record value then loop rows in report

Wow, Sorry, Thank you for responding. That went way over my head. The reset that I was trying to do is when the loop gets to the end of the row, it reads the next row values and then populates the check box values as it reads the new rows of values. I wasn't sure that when finished, the new values would replace the previous row values to populate the new boxes.

I'm going to have to rethink the whole process.

Thanks again

buzzbait9 is offline   Reply With Quote
Old 08-11-2018, 09:37 AM   #4
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 819
Thanks: 0
Thanked 185 Times in 185 Posts
June7 will become famous soon enough
Re: Choose checkbox by record value then loop rows in report

Did you try the suggestion?

The concept is if [a] = 1 then the checkbox will show True otherwise it is False. Since this is a data-dependent expression, each record will show result specific to its data.

This assumes [a] is a field in the report RecordSource. Now this brings up the question of how fields [b] through [m] factor into this. You don't show any code for that. Better describe the logic you are trying to code.

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
June7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Report to Show Two rows for Each Record khwaja Reports 11 03-22-2015 04:08 PM
Changing the report record source within a loop gerrg Reports 9 08-18-2012 06:31 AM
Choose specific rows using a query mrd1019 Queries 5 05-01-2012 11:15 AM
Hiding Record in Report based on checkbox value - Access 2003 Oscar Mike Reports 2 07-05-2011 01:26 PM
RE: Making an image visible if a record has a true checkbox in a report jezzamaster Reports 2 07-28-2005 07:24 PM




All times are GMT -8. The time now is 08:45 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post

Is Political Correctness Toxic?

Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World