Requery affecting all form records

peter2012

Registered User.
Local time
Today, 19:48
Joined
Apr 11, 2012
Messages
24
I have a data entry form for recording time.

On selecting a client in a client combo box, and tabbing out of the client field, the matter recordset is requeried, using this code:

Private Sub ClientName_AfterUpdate()

MatterName.Requery

End Sub

The result is that the choice of matters in the matters combo box is limited to that client's matters, rather than all clients' matters.

In other words the matters field is a dependent dropdown (dependent on the clients field).

When leaving the record the timecards table is updated with the data.

So far so good.

However, when I create a new record in the form and then return to the original record or generally scroll backwards through all records the matter box in each record becomes blank. This is just in the form, not the table. It's like each time I tab out of a client box the form requeries the matter box in all the records, not just the one I'm working in.

If I open the form and just scroll around without entering or changing client, then there is no problem. It is when I run the requery by altering and tabbing out of the client combo box that there is a problem.

Any advice anyone on how to stop the requery affecting all of the matter fields in the form?

(In case it's relevant, there is a requery on leaving the matter field too. That one requeries another field (the hourly rate field) to get the right choice(s) in that combo box, i.e. a sort of secondary dropdown - client determines list of matters to choose from, matter determines hourly rate(s) to choose from. Can't think of any reason why making the matter field requery the hourly rate field would make the matter field go blank when returning to it, but I mention it just in case. Form works perfectly apart from this matter "blankness" arising on the form.)

Thanks

Peter
 
Last edited:
Without knowing anything much about your database and table setup, you can try to use the current event of the form to requery MatterName.
The current event runs each time the form moves to another record.
Putting a requery ( of Matter) on the current event should force the form to choose the matters for the current client.
 
Great thanks Jeannette, that worked, though I still don't understand why my issue was happening.

Peter
 

Users who are viewing this thread

Back
Top Bottom