Thursday, June 16, 2005

Access: How to Refresh Form Data or Data on a Control

Simple:

use the .Requery Method

Forms!FormName.ControlName.Requery

or if you want to refresh all controls in the form, then

Forms!FormName.Requery

4 comments:

Anonymous said...

Seems simple but my form doesn't refresh! Help!! I've tried the following code "on got focus" and "after update" but to no avail...

Me.Requery
[Combo47].Requery
[Combo43].Requery
[Combo28].Requery
[Combo24].Requery
[Combo35].Requery
[Label Group].Requery

Dave
dave_gillian@hotmail.com

Anonymous said...

I tried to use the Forms!FormName!Requery ... But to no avail ... It doesn't work ... Here's the Code ...

MsgBox "Week ID" & Me.WeekEndDate, vbOKOnly, "Week ID"
MsgBox "Pass Date" & PassDate, vbOKOnly, "Pass Date"
MsgBox "Staff ID" & Me.staff_id, vbOKOnly, "Staff ID"
'SQLString = "UPDATE T_TIMESHEET SET T_TIMESHEET.submitted = 1 where [T_TIMESHEET].[yr_qtr_mo_wk_id] = " & Me.yr_qtr_mo_wk_id & " And [T_TIMESHEET].[staff_id] = " & AuditorID & " ; "
'MsgBox "Query Is " & SQLString, vbOKOnly, "Query"

'DoCmd.RunSQL (SQLString)
DoCmd.RunMacro "M_TIMESHEET_UPDATE"
MsgBox "Time Sheet was Submitted for Review", vbOKOnly, "Submit"
Forms!F1_TIMESHEET_TEST!Requery
DoCmd.Close
DoCmd.OpenForm ("F_TIMESHEET_TEST")

I would comment out the last two lines ... They don't work either ...

Please help!!!

Benny

RunnerGirl said...

Thank you!
I had to go one layer more since it was a subform I needed refreshed.

Crater said...

Perfect, exactly what I needed.