Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Allowing users to set update value?

Posted on 2014-01-05
4
Medium Priority
?
276 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

722 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