Set the value of a textbox based on the value of another textbox

What VBA code do I use to set the value of a textbox based on the value of another textbox?
here it goes,

I have tabcontrol with 3 page in it. every page consists of 5 text boxes
4 boxes are set visible to false, not until the first box meet the certain criteria and the second box will be visible, when the 2nd box meet the 2nd criteria the box will be visible as well and so on.
the second and third page are the same with page 1. they have 5 boxes each tabpage and same condition as page1.

now, my question is.

how can I append the records in a table in just 1 field without blanks.

let say, on page 1
textbox 1 = 10
textbox 2 = 15
textbox 3 = 20
textbox 4 not visible
textbox 5 not visible
on page 2
textbox 1 = 5
textbox 2 = 18
textbox 3 not visible
textbox 4 not visible
textbox 5 not visible
on page 3
textbox 1 = 3
textbox 2 not visible
textbox 3 not visible
textbox 4 not visible
textbox 5 not visible

the table will appears like this

Table sample

Sponsored Links:

Related Topics

confused with append method
here it goes,

I have tabcontrol with 3 page in it. every page consists of 5 text boxes
4 boxes are set visible to false, not until the first box meet the certain criteria and the second box will be visible, when the 2nd box meet the 2nd criteria the box will be visible as well and so on.
the second and third page are the same with page 1. they have 5 boxes each tabpage and same condition as page1.

now, my question is.

how can I append the records in a table in just 1 field without blanks.

let say, on page 1
textbox 1 = 10
textbox 2 = 15
textbox 3 = 20
textbox 4 not visible
textbox 5 not visible
on page 2
textbox 1 = 5
textbox 2 = 18
textbox 3 not visible
textbox 4 not visible
textbox 5 not visible
on page 3
textbox 1 = 3
textbox 2 not visible
textbox 3 not visible
textbox 4 not visible
textbox 5 not visible

the table will appears like this

Table sample


SET focus back to TEXTBOX if validation does NOT pass
I have a textbox with a validation in the "lost focus" property. if the text the user inputs in the textbox is incorrect, it clears out the textbox. but, for some reason after the validation message box appears for the user, the cursor moves to the next textbox.

how do I get the cursor to go back to the original textbox with the validation?

basically, until the user enters a correct string, the cursor will not move to the next textbox.


SET focus back to TEXTBOX if validation does NOT pass
I have a textbox with a validation in the "lost focus" property. if the text the user inputs in the textbox is incorrect, it clears out the textbox. but, for some reason after the validation message box appears for the user, the cursor moves to the next textbox. how do I get the cursor to go back to the original textbox with the validation? Basically, until the user enters a correct string, the cursor will not move to the next textbox


AfterUpdate Not Firing
I have a subform which has a textbox in the footer which calculates a total amount. On my main form I have a textbox with the control source set to the textbox on my subform.

What I want to do, is every time this textbox changes, to update another textbox with the same amount. So Textboxtotal and TextboxCopy are the same all the time.

I understand that the afterupdate event wont fire as it is not updates via keypress, but I'm stuck there.


Show Label & Text Box in Report based on Checkbox
I am attempting to show a label and textbox based on a checkbox in a report. The report is based on a SQL query joining two tables. The checkbox field is included in the query. Currently in the properties, I have the label and textbox .visible = false. I would like to set the label and textbox to
visible when the checkbox response = Yes.

I tried the OnLoad event of the form

Private Sub Report_Load()
If Checkbox = "Yes" Then
Label.Visible = True
Textbox.Visible = True
End If
End Sub

This didn't work. I am unable to define the event for the textbox and label directly because this is a report and not a form.


How to auto update a textbox value when other textboxes + checkbox are not = null
I have a form with a couple of textboxes and a checkbox.

What I am trying to achieve is to update the content of a textbox called My textbox (there is a space in the name) automatically when some conditions are met

The first case: The value in My textbox should be set to Reviewed when 3 textboxes have values inserted (they are empty by default so when they are no longer empty My textbox should be updated automatically). The three textboxes are called txt_Verification, txt_Check and txt_final.

The second case: The value in My textbox should automatically be set to Ready for dispatch when the checkbox called Chk_Final_Approval is being checked (it is unchecked by default


Date formatting in form textbox controls
I've set the Format of my textbox to mm/dd/yyyy on my FORM.

I've set the Format of the BirthDate field to mm/dd/yyyy on my TABLE.
The Data Type of the BirthDate field is set to Date/Time.

When I enter: April 6 1967
The date shows up in the textbox as 04/06/1967 when it losesFocus.
The date is also stored properly in the table as 04/06/1967.
Everything is mm/dd/yyyy just as I want it.

MY ISSUE IS:
When I CLICK on the textbox to edit it, the date switches to 06/04/1967, yet when I change focus to another textbox, it returns to 04/06/1967. When I simply tab between textboxes this doesn't seem to happen, only when I CLICK and the cursor appears in the textbox.

Why is this happening and how can I fix it so that even when editing, it shows mm/dd/yyyy in the textbox


Arrows on textbox remove
I have various textboxes on my form. However when you point to a specific textbox some arrow type buttons appear on the right side of the textbox impeding on the actual textbox space. I do not want these there, is there a way to remove them?


How to update textbox using combobox
my question is, what can I do so that when I click a command button the text shown in a textbox or combobox will be added to an other textbox preserving the old values for that textbox


Autopopulate a textbox based on the lookup table
I have a requirement to autopopulate a textbox (DIVISION_CD) based on the value in another textbox(LINE_CD).

A table - DIVISION already exists which contains the 2 columns - LINE_CD and DIVISION_CD. How can I use the DIVISION table as a lookup table to autopopulate the values in the DIVISION_CD textbox based on the matching value in the LINE_CD textbox.

Would somebody know on how to about this ? I have googled regarding this but have not been able to find any solution. Any


SelStart not accounting from spaces?
So I have a textbox in the header of one of my forms. For it's On Change event I have it filtering the form based on whatever is entered in the textbox. This works great. However, after the filter is re-applied after each "change", I have SelStart code to place the cursor back in the textbox.

Problem is that SelStart does not seem to be accounting for any spaces in the textbox, and continues to place the cursor after the last character - not space - in the textbox.


DLookup with Null criteria
But I'm running into this issue. I have a textbox with a control source as a DLookup. The recordset contains IDs from different tables, and I want the customer name to display in a textbox related to the customer id. but this is what I have/get

textbox = #Name? when CustID is null, using Nz and setting the textbox to an empty string if there was no Customer id

=IIF(IsNull(CustID).) and =IIF(Not IsNull(CustID). And still the textbox always turns up as #Name?

I tried to evaluate the code in vba and even when CustID is null, it still attempts to evaluate the DLookup instead of just giving me the appropriate value.

I realize that I can set the value of this textbox on Current event, or through VBA using simple If statement, but is there a solution where I can just set the controlsource in design to evaluate it?


TextBox Content
I have made an application with some textbox. I found that when I click on a textbox, its content and texts are moved to right. It seems there is one space at the begin of the textbox.


How to solve "Unbound Textbox"
I have a basic database, contains:
1. ID
2. Name
I want to have a textbox for user enter amount of money and then click a button. Then a report appear (must have a textbox value in form Input - do not tell me add this textbox like a filed in DB).
I try 1 day but it did'nt work.


Enable checkbox when locked textbox changes
I have a form that has a locked textbox and other textboxes (not locked) and some checkboxes. I would like to enable two of the checkboxes when the data on the textbox changes. I added a not visible textbox with the control source of the locked textbox and used it's afterupdate event, but this does not fire as I tab through the records. What do I need to do to make thiswork?


sorting data in a textbox control
To sort data in a txt box. I am using this textbox on a report and have concatenated group totals in the textbox.

I need to find the Median of the list and in order to do this, the list, in the textbox needs to be sorted.


Edit user name
I have a combo box which displays all the users from a table. Based on the value in the combo box, a textbox gets automatically updated. For example, if I am selecting John in the combobox, then the textbox also says John. I am using the textbox to edit userName.

Now the problem is, the Textbox is bound to the UserName field in the table. So when I type "Johnny" in the box, then it immediately gets updated in the table. I want it to get updated only when I click on the update button.

I understand this is happening cos the textbox is bound to a field in the table. I am also aware that I can make the textbox "unbound" and write code on click of the update button to manually update the table (by using a query). But if I make the textbox as an unbound field, then the value doesn't change based on what I select in the comboBox.

So it is possible to make the value in the textbox change based on combobox selection and also update the field only onClick of a button


data from one form to another form..
I have 2 tables in microsoft access with corresponding forms (table1:form1) & (table2:form2). in form1 I have 3 fields: result(dropdown) & name(textbox)&address(textbox).in form2 I have 2 fields: name(textbox)& address(textbox).

what I want is when I choose the "POSITIVE" in the form1 result(dropdown),the name(textbox)and address(textbox) I entered are copied to name(textbox) & address(textbox) inform2 and this will happen as I exit the form1 or if ill make a new record.


sum in form footer
I have this problem and I cant figure it out how many times I have tried it myself.

I have this subform, and it has 4 textbox: three that is bound and the one that is unbound form.

when I do calculations in the bound textbox, I can successfully arrive at the sum of textbox3 but when I sum the fourth unbound textbox, it give an error inside the textbox.

Does it mean I cannot make a summation of an UNBOUND textbox


Append to TextBox Not OverWrite
I am using ADO to cycle through data in a table. I want to be able to display in a textbox on a form each record that the textbox cycled through. My problem is that each subsequent record that is cycled overwrites the value that is already there, so the result I get is only the final record that is touched. How would you set VBA to show all