Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to refresh the subform so that it display the most current data

Status
Not open for further replies.

maupiti

Programmer
Oct 27, 2003
240
US
Access 2003

I have two forms.

Main Form Name: Form_Main
Sub Form Name : Sub_Form_Error_Record

After a button is presses, it delete the underlying table in the subform. Now I just need to update the subform so that it will display the data instead displaying the
text #Deleted.

The code below result in an error message

Run-time error '438'. Object doesn 't support this
property or method. The yellow highlight is on the code

Forms!Form_Main!Sub_Form_Error_Record.Form!
Record_Number.SetFocus = True

/////////////////////////////////////////////////////

Private Sub Refresh_The_Form
Forms!Form_Main!Sub_Form_Error_Record.Form!
Record_Number.SetFocus = True
SendKeys "+{F9}", True
End Sub
 
look up the help on requery - not refresh - can't remember exactly but I'm sure that's what you need

e.g.
Forms!Form_Main!Sub_Form_Error_Record.requery

or
Forms!Form_Main!Sub_Form_Error_Record.Form.requery

 
Hi PizMac. I did as you have suggested, but the subform did not refresh and display new records.

There is no error associated with the statement
Forms!Form_Main!Sub_Form_Error_Record.Form.requery

Somehow, I need to set the focus on the subform, and do a refresh. When I placed the cursor on one of the field in the subform, and hit refresh (Shift-F9), it did display the most current data.
 
And what about this ?
Forms!Form_Main!Sub_Form_Error_Record.SetFocus
Forms!Form_Main!Sub_Form_Error_Record.Form!Record_Number.SetFocus
SendKeys "+{F9}", True


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV, and thank you for helping me. I did as you have suggested, but the subform still did not refresh.

On the Subform properties, the Link Child Fields and
Link Master Fields are both blank, since this subform data
is not in anyway link with the data of the main form.

//////////////////////////////////////////////////////////
 
Hi PHV. To make it work, you would need two sendkeys
statement as shown below.

Forms!Form_Main!Sub_Form_Error_Record.SetFocus
Forms!Form_Main!Sub_Form_Error_Record.Form!Record_Number.SetFocus
SendKeys "+{F9}", True
SendKeys "+{F9}", True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top