Full Version: Change field value with a button
UtterAccess Forums > Microsoft® Access > Access Forms
What I'm trying to do is to change the value of a field (of the record currently displayed on the form) that is not displayed on the form by pushing a button. How do I go about this?
Jack Cowley
Welcome to Utter Access Forums! -o!
On the On Click event of the command button:
Me.NameOfField = 17
Change the data above as needed...
Thanks for the quick reply!
(The table the record is on is called Roster, the field is called Status.)
After I changed the click event to Me.Roster=Inactive and clicked on the button I got a message saying my DB can't find the Macro 'Me.'
What should I do now?
HAs you can see I'm somewhat of a newbie and appreciate all the help
Jack Cowley
If the field Roster is a field in the table the form is based on then do the following:
pen the property sheet for you command button.
Click in the On Click property and click the down arrow at the right of the field.
Select [Event Procedure] then click the button to the right with 3 dots.
The code editor will open and the cursor will be flashing between two lines of code.
Typ in this line of code:
Me.Roster= "Inactive"
You should know that if you have Active and Inactive you should have a lookup table for those values and you should be storing the primary key for Inactive, not the text Inactive. Therefore the Data Type of the Roster field should be a number...
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.