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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to REFRESH SUBFORM data! amateur

Status
Not open for further replies.

pauljkeenan

Programmer
Jun 19, 2006
41
TR
Hi people

I have a mainform and below that a subform used to display recordsets. On the main form I have a "refresh list" button, which justs refreshes the data. I have been using the following code but I get a STRANGE error when I click the button

"runtime error 2465, M.Access cant find the field 'frmVisaSearchSub' referred to in your expression."

Im pretty sure that the code is correct, I copied the syntax from a tutorial. "Me!Subform1.Form.RecordSource" Could someone please advise a newbie? Here's the code

Private Sub cmdRefreshList_Click()
Dim qSql As String
qSql = "SELECT * FROM [tblRecordInfo] "
Me!frmVisaSearchSub.Form.RecordSource = qSql
Me!frmVisaSearchSub.Form.Requery

End Sub

the name of the subform is correct, but I always get this error. Thanks guys, very much appreciated.
 
Hi!

You need to use the name of the subform control. frmVisaSearchSub sounds like the name of the form itself. You can find the name of the control by opening your main form in design view, right click on the subform control and choose properties.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thanks a million Jeff, this is whats been causing me so much trouble, its all so simple now. I had been calling the name of the form and not the control, which is an honest mistake for a newbie, what? yes

Thanks again man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top