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
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: