Solved

Allowing users to set update value?

Posted on 2014-01-05
4
271 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

829 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