referencing and action

johnlatona123

Innovator
Local time
Today, 09:52
Joined
Sep 20, 2011
Messages
85
hi all,

i could use some help here.

ive got a form with a subform

subform has 2 check boxes

i have a button on the main form

im trying to click the button on the main form to reference one of the checkboxes on the subform and click another check box on the subform based on the value of the first check box. once the box i want to check becomes check, it will then run its own on-click action. the subform is a continuous record form.

so:

[FrmEntryControl] is the main form name
[master subform] is the subform name
[verify] is the check on the subform that is checked
[page1] is the check on the subform that i want to check

Private Sub Command140_Click()

'If [master subform].[verify] = True Then [master subform].[Page1] = True

'If Me.Parent![master subform].Form![verify] = True Then Me.Parent![master subform].Form![Page1] = True

End Sub

i tried these with no luck, advice?
 
thanks for the links, ive played with the idea further and heres where i am at:

Private Sub Command140_Click()

Dim rs As adodb.Recordset

Do While Not Recordset.EOF

If Me![master subform].Form![verify] = True Then

Me![master subform].Form![Page1] = True

End If

Recordset.MoveNext

Loop

End Sub

the problem now is that it will check the appropriate box [page1] in ONLY the first record in my subform but will not run the on click event on [page1]

it doent seem like its 'clicking' the check box whereas it is merely marking it true and thusly the 'on click' event is not running

the next issue is that it needs to cycle through all the records in the subform and do the same for all other records

i have tried rearranging the way i am calling out the fields/tables based on the link provided by spikepl, however i think i am over looking something.

any ideas?
 
also, this code is not providing any errors, it runs smoothly other than the fact it doesnt do what i want it to do. ha!
 
A control's click event is not triggered by code. But in code you can call the same sub.

Your current loop is neither here nor there - I am not quite sure what you want. For looping over a record set, google "looping recordset". To change a value in a field of all records of a form , you can loop through the RecordsetClone of that form.
 
alright, ive spent all morning surfing the web for solutions to my problem, and maybe ive found one, i dont really know. ive tried many methods that i have come across and maybe i am just not referencing things correctly, but in any event, i could use some help here.

i still need to do the following:

form with a subform
subform has multiple records

main form has a button (need to do an on click event)
subform has a 2 checkboxes
chk1 is unchecked and has a sub that needs to be run IF
chk2 is checked

please help me write this. im struggling here.

thanks.
 

Users who are viewing this thread

Back
Top Bottom