?
Solved

Refer to a calculated control in a subform from a recordset.

Posted on 2014-04-29
5
Medium Priority
?
59 Views
Last Modified: 2016-05-29
Hello Experts. I have an issue which is out of my area of expertise and could really do with some expert help, so thanks in advance:

I have some code which is meant to update some values in a subform. The recordset I am using must refer to the values in a calculated control on my subform - and this is what I am struggling to do.

How do I refer to my calculated control from with a recordset?

This is my current code:

        Dim rsc As DAO.Recordset
        Set rsc = [frmAllocateToBuildComponentSub].Form.RecordsetClone
        rsc.MoveFirst
        Do Until rsc.EOF
        rsc.Edit
        rsc!stockcheckqty = *** SOMETHING LIKE THIS : stockcheckqty - mycalculatedcontrol) ***
        rsc.Update
        rsc.MoveNext
        Loop
    

Open in new window



If it helps here is a snip of my button and the controls I want to refer to:

RecordSet and Calculated Control
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40029867
Assuming you have controls named stockcheckqty and mycalculatedcontrol this should work:
rsc!stockcheckqty = stockcheckqty - mycalculatedcontrol

Open in new window

0
 

Author Comment

by:Computer_Support_Norwich
ID: 40029909
Hi... thanks for the reply.

I already tried that but it won't work. I assume because the button is on the parent form and the controls are on the subform. The code runs but sets all my values to ZERO and I have previously identified it's looking on the parent from when I use that code.
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 40029949
Oh i see:
rsc!stockcheckqty = Forms![main form name]![subform control name].Form![stockcheckqty] - Forms![main form name]![subform control name].Form![mycalculatedcontrol]

Open in new window

0
 

Author Comment

by:Computer_Support_Norwich
ID: 40063875
Hi - sorry for delay in responding, this is a project I only pick up once every couple of weeks. I will check it out and come back to you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question