Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Change field value programatically

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
awilson1199
Asked:
awilson1199
1 Solution
 
GudareCommented:
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
 
frankylewCommented:
supporting Gudare ...
0
 
awilson1199Author Commented:
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
 
PhilipECommented:
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
 
awilson1199Author Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now