Requery Control on Continuous Form (1 Viewer)

chuckcoleman

Registered User.
Local time
Today, 10:42
Joined
Aug 20, 2010
Messages
357
Hi,

I have a Continuous form. On each row there are two fields important to this question. One if a Option Group and the other is a date field. At the bottom of the form is an unbound text box with the following control source: =DCount("*","[Count Work Completed]"). The DCount works properly. It evaluates the data for the Option Group and the date field.

I'm trying to get the text box to update with the count after the entry for the Option Group or the date field occurs. The Option Group works perfectly 100% of the time. The date field never updates the text box. I've tried before update and after update on both the text box and the form itself. I've put a command button on the form for testing purposes and it works 100% of the time to update the text box. It's just after entering a date in the date field.

The code I've used is:

Dim UpdateNbr As Control
Set UpdateNbr = Forms![Work Completed Form]![NumberToUpdateX]
DoCmd.RunCommand acCmdSaveRecord
UpdateNbr.Requery

OR simply

Me.NumberToUpdate.Requery

I haven't been able to get either to work. I'm wondering if the continuous form is creating the challenge.

Any ideas?

Thanks,

Chuck
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:42
Joined
Oct 29, 2018
Messages
21,360
Hi. Try it this way:
Code:
Me.Recalc
 

chuckcoleman

Registered User.
Local time
Today, 10:42
Joined
Aug 20, 2010
Messages
357
Hi DBG,

It works, the only issue is that it takes longer to recalc the form than requery a field, which is annoying when there are several rows to update.

Do you see a way around this?
 

chuckcoleman

Registered User.
Local time
Today, 10:42
Joined
Aug 20, 2010
Messages
357
Problem solved; it turned out much easier than I thought. In the forms Current event, I used Me.NumberToUpdate.Requery and it works perfectly! I didn't need any of the other events. Geesh.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:42
Joined
Oct 29, 2018
Messages
21,360
Problem solved; it turned out much easier than I thought. In the forms Current event, I used Me.NumberToUpdate.Requery and it works perfectly! I didn't need any of the other events. Geesh.

Hi. Glad to hear you go it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom