Problem with Requery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings all
I've got problem using requery method
I have a form with subform and this subform has listbox acting as the 3rd level subfor
I put requery method on the OnCurrent event so that when user move from record to record on the subform, the respective listbox that shows records related to it will change as well
The problem happens when I add records on the subform (I add it in coding when record on the mainform is added)
Everytime method recordset.addnew is executed the oncurrent is triggered and the requery method is run. This makes my code fails (error 3020, adding record without add new

Any help is greatly appreciated

Cheers
Djoezz
 
Djoezz said:
I've got problem using requery method.
I have a form with subform and this subform has listbox acting as the 3rd level subform
I put requery method on the OnCurrent event so that when user move from record to record on the subform, the respective listbox that shows records related to it will change as well.
The problem happens when I add records on the subform (I add it in coding when record on the mainform is added).
Everytime method recordset.addnew is executed the oncurrent is triggered and the requery method is run. This makes my code fails (error 3020, adding record without add new)


I don't think I fully understand what you're doing here,
Using code to add a record in the subform when a record is
added in the main form causes Current event to execute???

You might want to try skipping the requery when you're in
the middle of creating a new record.

If Not Me.NewRecord Then
Me.listbox.Requery
End If

or maybe you need to set a flag variable when your "add a
record" code is about to run so the Current event can skip
the requery.
 
Back
Top