Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i link two Text Boxes?

Status
Not open for further replies.

Ringers

Technical User
Feb 26, 2004
180
AU
I have a Date text box(Branch_Warranty_Exp) and txtBoxMessage. The Date text box shows dd/mm/yyyy. I want txtBoxMessage to show different text depnding on the date shown. I have written the code to meet the different conditions.

But i don't know how to get txtBoxMessage to update automactly every time the Date field changes. Below is my condition code.

If (Branch_Warranty_Exp > Date - 9 And Branch_Warranty_Exp < Date - 12) Then txtBoxMessage.SystemOut.printLn (" Warning you have three months of warranty left")

If (Branch_Warranty_Exp < Date - 12) Then txtBoxMessage.SystemOut.printLn ("Out of Warrnty")

If (Branch_Warranty_Exp > Date - 12) Then txtBoxMessage.SystemOut.printLn ("Warranty Still Valid")

This properly very easy but i don't know access very well. So any help you could provide would be greatly appreaicated. Thanks in advance.
 
How are ya Ringers . . . . .

Put the code in the [blue]AfterUpdate Event[/blue] of the [blue]Date[/blue] textbox.

Calvin.gif
See Ya! . . . . . .
 
Sorry tried that and doesn't work, and anybody know the equivlient of 'SystemOut.PrintLn' for VB?
 
Are you asking how to get a mesage box in Access VB(A)?

[tt]If (Branch_Warranty_Exp > Date - 9 And Branch_Warranty_Exp < Date - 12) Then
MsgBox "Warning you have three months of warranty left"
End If[/tt]

Roy-Vidar
 
Hi,
I am trying to combine Roy & Aceman1's inputs into one

Put the code in the AfterUpdate Event of the Date textbox.
Code:
If (Branch_Warranty_Exp > Date - 9 And Branch_Warranty_Exp < Date - 12) Then 
  Me.TxtBoxMessage.Value = "Warning you have three months of warranty left"
Else
If (Branch_Warranty_Exp < Date - 12) Then
Me.TxtBoxMessage.Value = "Out of Warranty"
'Else
'Another ...
'End If
End If
End If

Zameer Abdulla
 
Ringers . . . . .
Ringers said:
[blue]I want txtBoxMessage to show different text depnding on the date shown.[/blue]
Ringers said:
[blue]anybody know the equivlient of 'SystemOut.PrintLn' for VB?[/blue]
Anybody know which way is North?

Calvin.gif
See Ya! . . . . . .
 
Hi

If txtBoxMessage is a text box control on the form then:

Select Case Branch_Warranty_Exp
Case >= DateAdd("m",-9,Date()) And < DateAdd("m",-12,Date())
txtBoxMessage = " Warning you have three months of warranty left"

Case < DateAdd("m", - 12,Date())
txtBoxMessage = "Out of Warrnty"
case Else
txtBoxMessage = "Warranty Still Valid"
End Select

in the after update event of Branch_Warranty_Expire, and similar code repeated in the oncurrent event of the form should do it

if you want a message box, then follow Roys advice

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top