Solved

Allowing users to set update value?

Posted on 2014-01-05
4
275 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
[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 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 85

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 48

Expert Comment

by:Dale Fye
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

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

623 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