473,705 Members | 4,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assign textbox value from command button

I'm trying to assign a custom value to a textbox. Here's what I have.

I've created a module and "default value" code for a textbox which
generates a custom auto-number (yyyy-0000) when a New Record button is
clicked. The code checks the table for the highest value and then
assigns 1 and inserts the value. I have a second text box which needs
the same type of custom auto-number which has to be generated from a
second command button. The numbers in the two text boxes are not
related to each other sequentially.

I have a main form and a subform. Both text boxes are on the main
form, but, one textbox is related to records on the main form, and the
second textbox is related to records on the subform. There is a reason
for having the second textbox on the mainform rather than in the
subform. The subform may have 1-10 records related to the one record
on the mainform.

Clear as mud??

What I'm trying to do, is click a button and assign an auto-number in
the second textbox, similar to the way the New Record button does for
the first textbox. When I apply the same code (revied for second
textbox) when I click the New Record button for the first text box, it
assigns a number to the second text box. I need them to be independant
of each other. I've tried running code , running macro etc. in the
OnClick event and nothing.

Any help would be appreciated.
dskillingstad

Nov 13 '05 #1
2 15721
To assign a value to a textbox in a button's click event, you would use
something like:

Me.txtMyTextbox = Value

where txtMyTextbox is the name of the textbox you want to assign the value
to. Make sure you have the correct name in your code for the textbox you are
wanting to update.

--
Wayne Morgan
MS Access MVP
<ds***********@ gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I'm trying to assign a custom value to a textbox. Here's what I have.

I've created a module and "default value" code for a textbox which
generates a custom auto-number (yyyy-0000) when a New Record button is
clicked. The code checks the table for the highest value and then
assigns 1 and inserts the value. I have a second text box which needs
the same type of custom auto-number which has to be generated from a
second command button. The numbers in the two text boxes are not
related to each other sequentially.

I have a main form and a subform. Both text boxes are on the main
form, but, one textbox is related to records on the main form, and the
second textbox is related to records on the subform. There is a reason
for having the second textbox on the mainform rather than in the
subform. The subform may have 1-10 records related to the one record
on the mainform.

Clear as mud??

What I'm trying to do, is click a button and assign an auto-number in
the second textbox, similar to the way the New Record button does for
the first textbox. When I apply the same code (revied for second
textbox) when I click the New Record button for the first text box, it
assigns a number to the second text box. I need them to be independant
of each other. I've tried running code , running macro etc. in the
OnClick event and nothing.

Any help would be appreciated.
dskillingstad

Nov 13 '05 #2
Thanks for the response. I'll give it a try.

dskillingstad
Wayne Morgan wrote:
To assign a value to a textbox in a button's click event, you would use
something like:

Me.txtMyTextbox = Value

where txtMyTextbox is the name of the textbox you want to assign the value
to. Make sure you have the correct name in your code for the textbox you are
wanting to update.

--
Wayne Morgan
MS Access MVP
<ds***********@ gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I'm trying to assign a custom value to a textbox. Here's what I have.

I've created a module and "default value" code for a textbox which
generates a custom auto-number (yyyy-0000) when a New Record button is
clicked. The code checks the table for the highest value and then
assigns 1 and inserts the value. I have a second text box which needs
the same type of custom auto-number which has to be generated from a
second command button. The numbers in the two text boxes are not
related to each other sequentially.

I have a main form and a subform. Both text boxes are on the main
form, but, one textbox is related to records on the main form, and the
second textbox is related to records on the subform. There is a reason
for having the second textbox on the mainform rather than in the
subform. The subform may have 1-10 records related to the one record
on the mainform.

Clear as mud??

What I'm trying to do, is click a button and assign an auto-number in
the second textbox, similar to the way the New Record button does for
the first textbox. When I apply the same code (revied for second
textbox) when I click the New Record button for the first text box, it
assigns a number to the second text box. I need them to be independant
of each other. I've tried running code , running macro etc. in the
OnClick event and nothing.

Any help would be appreciated.
dskillingstad


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8945
by: MJW | last post by:
Is there a way for me to know if or which command button was just clicked that triggers the LostFocus event for the current control on a Form? I have a form that has many types of users who each have their own set of fields they can change. Therefore I use setfocus property in the lostfocus event for some of the users to get from one control to another. Since I am "directing traffic" with setfocus, the users are unable to use the...
1
1606
by: Grey | last post by:
my idea is want to add textbox on the datagrid. the data of the textbox was extract from DB. use can change the value on the textbox anytime. after the change, user just click the button on the datagrid to save to DB. Is it possible to do that??? and how to ?? Million Thanks..
2
6099
by: rachit.goyal | last post by:
Hi All, I am using .net first time.In my windows form VC7 application, on a click of button, I am assigning text of TextBox to STL string varibale. Using this code- private: System::Void FindValuesButton_Click(System::Object * sender, System::EventArgs * e) { string fileLoc ; fileLoc= CD_location->Text->ToString();
4
4570
by: Surek | last post by:
I have created a form using the wizard, to display the contents of the table. I need to update the table by entering the data through the form. When i click the update button of my form, it ignores the last text box value. If i press tab and move to the next text box and click the update button, the last textbox value is taken into account. When i click the update button, the cursor should automatically be moved to the next textbox. How...
7
6517
by: pushrodengine via AccessMonster.com | last post by:
I have a command button “AddIncident”. I would like to make it so that it will not add the record to the database if textbox “Type” is empty. I also would like to add a message that will prompt the user with the message “You must enter incident Type” when textbox “Type” is empty and the “AddIncident” button is pressed. Thank You -- Message posted via AccessMonster.com
1
3669
by: =?Utf-8?B?U2FpbXZw?= | last post by:
Hello Marc Gravell and Machin. Good Day. Why your not using an Instance in the form and yet your using a New Form? Im using it because I want to open a single form only. If Im using a New Form1, In my command button If I will click the button to show the Form1 it will show the Form1 equal the click in the button. What you suggestion to me. Im new in programming in C#.
5
6066
by: lianping | last post by:
Hi, I have a problem to assign a value into text box, below will be my script. Before view my script, let me hv quick explain on what is my problem: I would like to assign Java script value into VB text box, but i fail to do so. I can pass value with using: <form id="form1" runat="server">. however I' not able to do so, as i already use runat="server" at my MasterPage. Is that any others way i can assign value into the TextBox. Error...
2
6258
by: digituf | last post by:
may i know if in php i can assign the textbox value from the user input as variables and then display the result of in the same page. assume, user insert the checkin and checkout date, then it wil automatically show the numbers of the day the user will stay at the hotel. any suggestion will really appreciates because i have no ideas what should i do ... below is the code
3
4414
by: ObiBenKenobi | last post by:
Hi there, I would like to know how to create an event procedure for a command button that uses the text of a textbox to go to a specified website. Example: User types "google" in a textbox, hits command button, and a web browser opens http://www.google.com. Any help would be appreciated. Thanks!
0
8768
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8690
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7895
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2491
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.