Solved

Allowing users to set update value?

Posted on 2014-01-05
4
265 Views
Last Modified: 2014-01-20
would there every be a way to allow user to select an option from a drop-down menu and then have that update/populate through all records of the database in that same field?
0
Comment
Question by:daisypetals313
4 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 39758601
Your question is somewhat brief, but from what I understand of your question the answer is yes. You'd capture the selection into a variable and use that in VBA to do the necessary updates.


Kelvin
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39758917
So you want to update EVERY value in a column, based on the value chosen by the user in a combo?

To do that:

Currentdb.Execute "UPDATE YourTable SET YourField=" & Me.YourCombo.Column(0)

If YourField is a Text field:

Currentdb.Execute "UPDATE YourTable SET YourField='" & Me.YourCombo.Column(0) & "'"

If YourField is a Date:

Currentdb.Execute "UPDATE YourTable SET YourField=#" & Me.YourCombo.Column(0) & "#"

Understand, however, that this updates EVERY record in the table. If you need to update only certain records you'd have to include a WHERE clause to the above statements.

Obviously, you'd have to change the Table, Field and Control names to match those in your project. This also assumes that the FIRST column in the Combo is the one to be used for the update value.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39759211
the question that would come to my mind (as feeble as it is) is:

If the values in a field "for all records in that table" are the same, then why do you even need the field?  

It sounds like that needs to be an application  wide value which you could load/store in a db_Properties table, or actually store as a property in the database.  If you do it this way, you could load that value into a TempVar or into a global variable when you start your application, then write it back if it changes.
0
 

Author Closing Comment

by:daisypetals313
ID: 39795160
thanks!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now