Requery listbox on mainform from Subform

Paul Cooke

Registered User.
Local time
Today, 15:41
Joined
Oct 12, 2001
Messages
288
Hi guys could someone tell me if it is possbile to requery a listbox on a main form, from the afterupdate event of a Subform?

I have a form called 'Vaccination' with a listbox called 'lstVaccinations'

On the mainform is the subform called 'VaccinationConsumablesSubform' the last control on this has a msgbox with yes / no response which works fine but I want to add a line to the vbyes AND the vbNo response that refreshes the lstVaccinations listbox.

what I have tried is....
Code:
'Message to ask if another vaccine product needs to be entered

    MsgResponse = MsgBox("Do you want to enter another vaccine?", vbQuestion + vbYesNo, "New Vaccine")

If MsgResponse = vbNo Then

    Forms!Vaccination.cboStaffID.SetFocus
    Forms!Vaccination.lstVaccinations.Requery
    
Else

    Forms!Vaccination.lstVaccinations.Requery

End If

End Sub

this does set the focus to the cboStaffId control but it does not refresh the lstVaccination listbox and I have no idea why !!

any advice will be greatly recieved

many thanks
 
Use this:

Me.Parent.cboStaffID.SetFocus
Me.Parent.lstVaccinations.Requery
 
Many thanks for such a quick reply Bob - Works perfectly now !

thanks again

Paul
 

Users who are viewing this thread

Back
Top Bottom