Solved

MS Access 2013

Posted on 2016-09-12
8
45 Views
Last Modified: 2016-10-02
My form has a text box that has an expression in it.  The expression is called expName3.  I need the value of that expression to populate into a table ~ in a field labeled NametoUse.  Is it possible to take the value from an expression on a form and have it populate into a table.  
Example Expression on my form:  If there is a value in the Name field on Form C then give me the Name else it blank leave blank.  Whenever the user types a different name the value in the expression will change.  I then need to capture  the value displayed in the expression and have it populate into a table.  Thanks
0
Comment
Question by:deefel
[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
  • 4
  • 2
  • 2
8 Comments
 
LVL 84
ID: 41793964
You can, but it's not really clear what you're doing.

Assuming your "example expression" is similar to your real one, then what's the point of storing the value from "Name" in another field? You've already got that value (in the Name column, presumably) so what's the point in storing it again?
0
 
LVL 40

Expert Comment

by:als315
ID: 41794007
Will be better if you upload sample DB with this form. related tables and some dummy data.
There is some difference in editing of existing data and entering new one. For new one set default value for table's field to your form's field. If you like to edit existing data and take value from unbounded field, you will need VBA code
0
 

Author Comment

by:deefel
ID: 41795162
~ I attached a sample database.  The field in yellow on the form is the value I would like to capture in the table.  Currently it is only displayed on the form.  Thanks for your help.
TestDatabase.accdb
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 40

Expert Comment

by:als315
ID: 41795428
What field in table should be filled? Do you like to fill it in existing records?
0
 

Author Comment

by:deefel
ID: 41795465
The ESTPrice field should be filled in the table with the value in the yellow box on the form (ESP_Price).  thanks
0
 
LVL 40

Accepted Solution

by:
als315 earned 250 total points (awarded by participants)
ID: 41795536
Look at sample. Press button for filling. You can add code from button to any action on your form (some field update, etc.)
TestDatabase.accdb
1
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points (awarded by participants)
ID: 41795797
I would encourage you to rethink doing this. In a relational database you should never store calculated data unless you're archiving that data (i.e. you'll never edit it again, and it's only for historical/reporting needs).

Access is not Excel, and should not be used like Excel. Multiple IIF statements, like you're using here, almost always indicate a poorly designed table structure. Issues like this are fairly easy to fix, as als has shown you, but as you move forward you'll find more and more obstacles (and when you get to the reporting phase, you'll find some that are nearly insurmountable).

Take time now, when you're just beginning to create your database, and build it correctly. It'll take more time now, but you will reap the benefits of a properly created database many times over as your application grows more complex.
0
 
LVL 40

Expert Comment

by:als315
ID: 41825215
Sometimes you need to save current price to document, because it could be changed later, but it is also obvious that calculated fields should not be saved without necessity.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

739 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