Solved

Checking a value in textbox 1 to assign a value in textbox 2

Posted on 2005-04-14
343 Views
I was wondering what would be the best way to automatically insert a value in textbox 2 if textbox 1 = A. An alternatively, if textbox 1 = B, then textbox 2's value would be different?
0
Question by:DanaCurnock

LVL 34

Accepted Solution

Hi Dana!

private Sub textbox1_Afterupdate()
If Me.textbox1.value = "a" Then
Me.textbox2.value = "something"
elseif me.textbox1.value = "b" then
Me.textbox2.value = "something else"
else
Me.textbox2.value = "something totally different"
end if
end sub

More help?

Dave
0

LVL 14

Expert Comment

Well, the basic command would be

If textbox1.Value = "A" Then textbox2.Value = "whatever"

But where to put it would depend on how textbox1 gets its value.  Is textbox1 getting filled from a table or query, or from someone typing something in?
0

LVL 27

Expert Comment

Hi DanaCurnock,
put this after update of Textbox1
Select [Textbox1]
case 1
[Textbox2]= "A"
case 2
[Textbox2]="B"
endselct

I hope this helps.

jaffer
0

Author Comment

JohnK813

The values are being either typed or filled by another cbobox.

0

Author Comment

jjafferr

I will be more detailed:

If txtTruckNumber = "C00981" Then

txtTare = "12680"
txtAggregateWeight = "25400"
ElseIf txtTruckNumber = " " Then

Else

End If
0

Author Comment

flavo

I missed you comment...is this correct???
0

LVL 34

Expert Comment

i did what?
0

Author Comment

Comment from flavo
Date: 04/14/2005 06:10AM PDT

I missed your comment...is this correct???

If txtTruckNumber = "C00981" Then

txtTare = "12680"
txtAggregateWeight = "25400"
ElseIf txtTruckNumber = " " Then

Else

End If
0

LVL 34

Expert Comment

That was the idea i posted..
0

LVL 34

Expert Comment

:-)

Good luck with the rest of your app Dana!
0

Featured Post

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…