BigCat53
asked on
Requery Based on a Checkbox
I have a form that contains two subforms. What I am trying to do is have a user select accounts on subform 1 that are delinquent and after they click the box for that record to indicate Yes, I would like the other subform, subform 2, to populate with that account so they can enter the reason it is delinquent. I know I have to use VBA Requery but I can not get it to work. The only way that subform2 populates is if I close and reopen. Could someone advise how to do this? Thank you in advance.
some more info for u
I have always preferred using Me.Parent or Me.subform but thats just me.
The other way of course is to use forms!formname!... etc
here is a useful guide for you
http://www.mvps.org/access/forms/frm0031.htm
I have always preferred using Me.Parent or Me.subform but thats just me.
The other way of course is to use forms!formname!... etc
here is a useful guide for you
http://www.mvps.org/access/forms/frm0031.htm
That was gonig to be my link :-)
So Sorry. I'll try to be slower next time :)
ASKER
When I use:
private sub chkBox_AfterUpdate
if chkBox.Value = True then Me.Parent.<<nameofsubform2 >>.form.Re query
end sub
I get the following error message:
Run-Time error '424'
Object Required
private sub chkBox_AfterUpdate
if chkBox.Value = True then Me.Parent.<<nameofsubform2
end sub
I get the following error message:
Run-Time error '424'
Object Required
ASKER
I get the error message after putting in the form name for the subform 2.
urm, did u change <<nameofsubform2>> to be the name of your subform?
it has to be the control name
if in your vba window for your main form
u typed in Me.
it brings up a list, u can then find the name given to your subform
or of couse look it up design mode
it has to be the control name
if in your vba window for your main form
u typed in Me.
it brings up a list, u can then find the name given to your subform
or of couse look it up design mode
ASKER
I do have the proper subform name
ASKER
This is my code that I am using:
Private Sub Past_Due_AfterUpdate()
If chkBox.Value = True Then Me.Parent.Engineered_Syste m_PD.Form. Requery
End Sub
Engineered_System_PD is the name of subform 2. I have the code in the After Update event for the checkbox in Subform 1.
Private Sub Past_Due_AfterUpdate()
If chkBox.Value = True Then Me.Parent.Engineered_Syste
End Sub
Engineered_System_PD is the name of subform 2. I have the code in the After Update event for the checkbox in Subform 1.
How are your subforms presented
Are they both subforms from one form
or is subform2 a subform of another subform (man after several beer's that sentence would do your head in!)
Are they both subforms from one form
or is subform2 a subform of another subform (man after several beer's that sentence would do your head in!)
if subform2 is a subform of subform1
u can do this
Me.Engineered_System_PD.Fo rm.Requery
u can do this
Me.Engineered_System_PD.Fo
or look at the link provided and try the various methods there
ASKER
Nothing is working.
Main Form: Accounts Past Due
Subform1: System_Accounts_Past_Due
Subform2: Manager_Accounts_Past_Due
Subforms are both subforms of Main form, but they are based on different querys (not sure if this matters). When the checkbox is clicked "yes" in subform1, I want That account to show up in Subform2. I put the following code in the Afterupdate event for the checkbox:
If chkBox.Value = True Then Me.Parent.Manager_Accounts _Past_Due. Requery
But I continue to get this error message: Run-Time error '424' Object Required
I don't know where to go from here. Obviously the code is wrong or the forms are linked wrong, but how do i know? Thank you for future assistance.
Main Form: Accounts Past Due
Subform1: System_Accounts_Past_Due
Subform2: Manager_Accounts_Past_Due
Subforms are both subforms of Main form, but they are based on different querys (not sure if this matters). When the checkbox is clicked "yes" in subform1, I want That account to show up in Subform2. I put the following code in the Afterupdate event for the checkbox:
If chkBox.Value = True Then Me.Parent.Manager_Accounts
But I continue to get this error message: Run-Time error '424' Object Required
I don't know where to go from here. Obviously the code is wrong or the forms are linked wrong, but how do i know? Thank you for future assistance.
Private Sub Past_Due_AfterUpdate()
If chkBox.Value = True Then Me.Parent.Engineered_Syste m_PD.Form. Requery
End Sub
Do you need the extra dot after the word parent ?
If chkBox.Value = True Then Me.Parent.Engineered_Syste
End Sub
Do you need the extra dot after the word parent ?
is chkBox the name of your checkbox field? I assume its Past_Due based on the AfterUpdate function?
If Past_Due is the checkbox, then do this
Private Sub Past_Due_AfterUpdate()
If Past_Due.Value = True Then Me.Parent.Engineered_Syste m_PD.Form. Requery
End Sub
Wotcha Carl!
If Past_Due is the checkbox, then do this
Private Sub Past_Due_AfterUpdate()
If Past_Due.Value = True Then Me.Parent.Engineered_Syste
End Sub
Wotcha Carl!
You a space after manager and before underscore:
If chkBox.Value = True Then Me.Parent.Manager_Accounts _Past_Due. Requery
If space is intended, it requires brackets; oterwise eliminate.
If chkBox.Value = True Then Me.Parent.Manager_Accounts
If space is intended, it requires brackets; oterwise eliminate.
ASKER
with the new code I get the following error message:
Run-Time error '2465'
Application-defined or object-defined error
any thoughts?
Run-Time error '2465'
Application-defined or object-defined error
any thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that did it. thank you for your assistance.
no probs
The other way should work as well, not to worry
The other way should work as well, not to worry
private sub chkBox_AfterUpdate
if chkBox.Value = True then Me.Parent.<<nameofsubform2
end sub