[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2014-04-29
5
Medium Priority
?
61 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

649 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