Full Version: Command Button
UtterAccess Forums > Microsoft® Access > Access Forms
phnix
I am trying to set up a command button that will change the data in two text boxes. I would also like the clicking of the button to prompt me for data to be inserted. The result would be by pressing this button, it would change one text box to predefined data (e.g. Authorized), while at the same time prompting me to ask what department it should be assigned to (e.g. accounting) and placing that data into another text box

Any help is appreciated
- Ryan
Edited by: phnix on Fri Feb 22 19:38:16 EST 2008.
TheGOG
Try

command_button_Click()

TXT_BX_1.SetFocus
TXT_BX_1.Text = InputBox.....
TXT_BX_2.SetFocus
TXT_BX_2.Text = "Authorized
Me.Refresh
Edited by: TheGOG on Fri Feb 22 20:33:56 EST 2008.
Steve Schapel
Ryan,
If I may, I would like to encourage you to re-think this approach.
Whereas it is possible for data to be entered via a prompt to the user, the normal data entry on a form would almost always be more user-friendly. In this case, where you are recording a Department, selecting from a pre-defined list via a combobox or list box, will reduce possible error and inconsistency, which will certainly arise if the user is entering it freehand in an InputBox.
Similarly, with the other field, the entry of the data via a combobox or (as seems a likely candidate in this example) an Option Group, would be preferable to trying to manipulate data via the Click event of a button.
Just my 2c...
phnix
the thing is the department doesn't have to be exact because it is not used for record keeping, rather just notes on a document. So if it says acouting instead of accounting, the person that sees the notes on the document will still be able to tell what department it goes to. The correctness of it isn't that important.
Thanks for the thought though.
Steve Schapel
That's cool, Ryan. Even so, I would still think it is easier to enter the data directly.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.