Updating Fields

Dave31

Registered User.
Local time
Today, 06:17
Joined
Oct 11, 2006
Messages
68
Hi

I cant seem to find the answer for this question. I have tried many types of refreshing and none seem to work.

I have two forms (form1 and form2 (for ease of understanding)) I have a flag (flag1) on form1 (this indicates if the peerReviewStatus is open or not). When all defects are classed as 'Closed' on Form2, Flag1 (on form1) is turned to "1". I have the code On_current that
Code:
if flag1 = "1" then
peerReviewStatus = "Closed"
me.refresh
end if

in thoery, when flag1 = "0" the peerReviewStatus is "open" (default) but if flag1 = "1", the peerReviewStatus is 'Closed'! so when the user returns to form1, i would like the peerReviewStatus field to automaticlly update to 'Closed' (as long as flag1 is "1").
The only problem is, its not updating when i return from form2 to form1. The only time it refreshing is when i closed form1 and return back to it.

Any ideas?
 
Try this. If you have both forms open on the same record you'll see the update occur.

Private Sub flag1_AfterUpdate()
Select Case flag1.Value

Case Is = 0

Me.peerReviewStatus = ""

Case Is = 1
Me.peerReviewStatus = "Closed"

Me.Recalc
DoCmd.RunCommand acCmdSaveRecord
Forms!Form1.Requery

End Select
End Sub
 
Thanks, it kinda works, but only if as you said both forms are open. The problem is, you close Form2 to get back to Form1 (its on the close button command that changes the Flag from "1" to "0" or vice versa!)
Shall i change this cancel command to another place?
 
Dave - what exactly is the sequence of events that occurs here? Is form 2 a pop up linked to form 1? If I understand your process I might be able to help more.
 
ok, ill try and explain further :)
Form1 is the meeting Form, here it displays all the detials about the meeting. including the peerReviewStatus field. There is a button called 'Close Defects', This will bring up form2 (defect form). Here you can close each defect off, when you hit the close button (form2 will close and it will change the flag1 on Form1 to "1" if all defects are closed (else if they arnt, then Flag1 will stay "0")
So now when Form2 closes, if the Flag1 is "1", i want the peerReviewStatus to update to "Closed" automaticlly.

I hope this helps, if there is anything else you dont understand, then ill try my best to help
 
Are your two forms linked using stLinkCriteria? Youu link the forms using your primary key.

I've used linked froms where there is too much info for one. When you open form2 two you minimise form2 not close it, then when you close form2 you restore form 1 and it will have the updated info on it. I can let you have an example tomorrow, I'm off soon. Cheers.
 
Ah, fantastic, i decided to close form1 when i closed form2 and then reopened it straight away, this causes it to update.

Many thanks for your help Barry :)
 

Users who are viewing this thread

Back
Top Bottom