Solved

Change field value programatically

Posted on 2001-07-06
5
196 Views
Last Modified: 2006-11-17
I am in Access 2000 and have developed an application with a form where the user looks up a record.

I want a button on the form to change the value of one of the fields on the form (the field has a table datasource) that puts that changed value into the table.

How can I do this?
0
Comment
Question by:awilson1199
5 Comments
 
LVL 2

Expert Comment

by:Gudare
Comment Utility
From what I understand of your question, if you go to the on_click event of the button and select the builder-code builder, the following pseudocode should work:

me.textboxonform = me.othertextbox

Please give more details to your exact request for a clearer answer. :)

-Craig
0
 
LVL 1

Expert Comment

by:frankylew
Comment Utility
supporting Gudare ...
0
 

Author Comment

by:awilson1199
Comment Utility
Haven't tried it yet, it is at work. I want the user to click a button and that will insert a "V" in a bound text box on the form which changes the data in the field from a "C" to a "V"
0
 

Accepted Solution

by:
PhilipE earned 50 total points
Comment Utility
Greetings AWilson1199,

As I do not know the name of the field you wish to change, we shall, for arguments sake, call it Field1.  Assuming this, the following code will perform the function you require.  First, however, you must create a button on the form.  Once you have created this button, right click on it in design mode, this will bring up an option box.  select PROPERTIES from this selection.  Give the button a legible name e.g. cmdFieldUpdate
In properties, select the EVENT tab and click on the CODE BUILDER button for the ON CLICK event.
Next select the option CODE BUILDER, this will fire up your VBA screen.  In this screen Include the following in the following:

Private Sub cmdFieldUpdate_Click()

Field1 = "V"

End Sub

It truly is as simple as that.

Hope I've helped.

YES! The first question I've been able to answer.  Roll on Expert of the week title (Yeh right!)
0
 

Author Comment

by:awilson1199
Comment Utility
You are right, that was too easy. I never considered something that simple, you should have seen some of the things I tried.

Thanks!
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
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…

763 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

6 Experts available now in Live!

Get 1:1 Help Now