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

Subform Bookmark question

Status
Not open for further replies.

hceonetman

Technical User
Mar 16, 2001
92
US
I have a form for purchase orders and a subform with payments against the PO in the parent record. If a payment type on the subform is identified as a closing entry, a piece of code runs which verifies that the amount entered properly zeros the balance. To do this, I open a recordset of the child records and total the entries by stepping through them one by one. If the value <> 0 I want to put the cursor back on the closing entry amount field, but I can't get the bookmark syntax right.

The main form is "frm_Purchase_Orders_Header" and the subform is "Subfrm_PO_Detail". In the code module I use Rs_PO_Header and Rs_PO_Detail as the recordsets.
The line "Set RS_Bkmrk = rs_PO_Detail.RecordSet.Clone"
gets me "Method or data member not found" error.

As a possible alternative, can I use the DSum function to get the line item totals instead of stepping through the records? I'm not sure which would be the preferred method.

Thanks for your help,
HCEONETMAN
You don't stop playing because you get old,
you get old because you stop playing.
 
Hi
DSum seems fine. Bookmarks generally look something like:
Code:
Set rs = Me.Subfrm_PO_Detail.Form.Recordset.Clone
rs.MoveFirst 'for example
Me.Subfrm_PO_Detail.Form.Bookmark = rs.Bookmark
 
Thanks Remou, but I get a compiler error "Invalid use of Me keyword". I tried it both exactly as above and using Rs_Bkmrk, which had been defined as an object. Either way the same error.
Might I be missing a reference? I notice only 4 in use:
VB for applicatios;
MS Access 9.0 Object Library;
MS ActiveX data objects 2.1 library; and
OLE Automation.
I know in other apps I've had more references checked.

I will be out for a week so if I fail to respond to a reply it's due to sun and surf and not ingratitude.

Thanks again
HCEONETMAN
 
The above snippet was intended to be in the module for frm_Purchase_Orders_Header. If this is not the case, the form must be named:
Code:
Set rs = Forms!frm_Purchase_Orders_Header.Subfrm_PO_Detail.Recordset.Clone
   rs.MoveFirst 'eg.
   Forms!frm_Purchase_Orders_Header.Subfrm_PO_Detail.Bookmark = rs.Bookmark
However, it may be best to put code in the main form. I am a bit unclear as to what you are doing, so my answers are even more vague than usual. Pehaps you could include a little of your code?
As for references, I tried these snippets in a database that only had the references you have, and all seemed fine. However, your 'missing' reference may be to Microsoft DAO x.x Object Library.
Enjoy the break [sunshine] [bigglasses] [wavey2]
 
Remou,
I tried to make this a standalone module so I could call on more than one event, though the same form will always be active when it is called. I'm sure it's something simple I've overlooked, but before I go further I will try to eliminate the need for this at all by forcing the value I want into the amount field and disabling edit on it. I probably should have gone this route in the first place.
Thanks again for the assist. I think I hear a beach calling my name.
HCEONETMAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top