Topics Search

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

Set the value of a textbox based on the value of another textbox
Views: 2288
What VBA code do I use to set the value of a textbox based on the value of another textbox?
Sponsored Links:

More topics

 

confused with append method

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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