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

Requery Table in subform.

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
0
0
NZ
I have a form with with a subform which has its Source Object set to a table called tblTyres. I use this table to add records to the tblTyres table. On completing data entry into tblTyres, I need the table to be requeried (qryTyres). This query is not embedded in the form.

I have tried various options and can't get it to work.

Any ideas

Thanks in advance.

Hayton
 
This is the obvious one:

Me!SubFormName.Requery

If this isn't the answer, could you let us know which "various options" you have tried.

Thanks

Bill
 
Bill it works. Thanks I have used this before. Don't know why it did not remeber to use it?
 
Hello,

I agree with the syntax but it will not work with Access XP! I am getting a run-time error 2465 and the verbiage says &quot;cannot find the field <subform name>&quot;.

And XP Help has no listing for the words subform or requery!!!!

Is something wrong here?


Regards, Sorrells
 
Hi Sorrells,

Firstly, after asking 26 questions, haven't you found any of them helpful by marking the post as &quot;Helpful/Expert&quot;?

Secondly, if XP Help has no listing for the words subform or requery then I certainly won't be upgrading to it. Other Member's feedback on this subject would be welcome.

Thirdly, Requery is just a simpler way of resetting a Form's RecordSource so you could try:

Me!SubFormName.RecordSource = &quot;MyTable/MyQuery&quot;

Where &quot;MyTable/MyQuery&quot; is the Form's original RecordSource.

Bill
 
Bill,

I don't understand the 26 questions and I did see a ask this question on the web in the XP help when it came up with nothing for the question 'Requiring a subform'. I went to the web and there was no help for me. But I got the solution as noted below. I've been working with Access 4 years now and never realized what I have recorded below.
=================================================
I found my answer but not without some pain. I converted the XP back to 97, moved it to my 97 PC and ran it. Same error. Now I have become convinced it is an error.

I was using the name of the subform as entered into the Database Window/Forms pane. But what access wanted was the Caption name of the subform. I have generally changed this from the object name because its display confuses the users.

I found this because I could use the BUILDER function in A97, something very lacking in XP unless it has evolved into something else!

Anyway, when I renamed the subform with the Caption property name, the simple code: <subform caption name>.Requery ran just find.

Now, I honestly do not understand why Microsoft designed it this way but perhaps this will help soemone else as well.

If there are any MVPs out there, I'd be curious as to the logic behind this. And dear Lord, I hope I remember this for future reference!


Regards, Sorrells
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top