subform "GoToRecord"

guldo76

Registered User.
Local time
Today, 05:18
Joined
May 9, 2002
Messages
22
I have a subform with a commandbutton and single records in it. As the button is clicked, I'd like to perform the "GoToRecord" action, but it doesn't work, claiming the form is not opened! Why??? Any hint would be greatly appreciated.
In fact, as the button is clicked, I want to append the record (that could be modified) to some table; but to do so I have to GoTo some other record, or the new modified record won't be appended in the destination table, am I right? The record would be appended unedited, right?
It works great on a normal form, but it doesn't if the very same form is used as a subform.

Thank you for your help,
Guldo
 
One hint....

Learn vba and create all your own controls.... Keep them in a seperate template project report and use them for further reference. If you made all your own recordsets and populated controls from these recordsets you would not have this problem I am sure... And there would be no need for a subform.... Someone else may help you with this for your immediate problem, but I can assure you will benifit from coding your own controls in the future...

Regards,
 
Thanks, BLeslie88.
But I did code my controls by myself.
I coded my own form, and it worked great. Then I inserted it in another form, and it no longer worked.
The problem can be simplyfied as follows:
Table1: products records (name, price)
Form1 (works): find a specific product, modify its price, append it to Table2.
Problem: The user would like to look at Table2, delete certain records, add new ones. I tried to do all on one form.
I can't.

Thank you all,
Guldo
 
In reply....

Well what I am presuming is that your code then is not local to the subform. If you also coded it yourself... Code it in the subform on it's own giving the table it's own recordset name, even though it's referencing the same table, use a seperate RST so that there is no conflist... If all your variable are local you should have no conflicts... Try doing all your coding on the subform before it is a subform.... That add your subform again back onto your main form.....

Hope I am explaining myself well....

Worse case scenerio zip your file attach it to your next message and I will fix it for you and send it back.... I can not access exterior e-mail at work so attach it in here, others may also offer additional help that way too.....

Regards,
 
Thanks a lot for your quick reply!!!
Forgive me, but what's "RST"? I'm italian!
Thank you very much!!!

Guldo
 
FIXED!!!
The line not working was:
docmd.gotorecord acdataform, "NBE", acfirst
because "NBE" was supposed to be missing or not opened. I tried and open the subform as 'standalone', while the big form was still there, and the VBcode recognized the 'standalone' as the desired one.
Anyway, browsing through various posts, I got to know this:
docmd.runcommand acCmdRecordsGotoFirst
that works! I didn't know it existed! Does this work because perhaps it's set to work on no form but the active one, while the former can be referred to any (open) form? Or there's a smarter reason why?

Anyway, thanks,
Guldo
 

Users who are viewing this thread

Back
Top Bottom