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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Text Box Comparison

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
US
Need to compare the date values in two text boxes . .

Existing Code:
Code:
Me!txtToDate = DateAdd("d", 84, Me!txtFromDate)

Basically, I am trying to run a compare based on DATEDIFF. I would like for it to compare the difference between Me!txtFromDate and Me!txtToDate to make sure it is under 84 days. Also, I would like for it to check and make sure that the difference is also a multiple of seven or make sure the DATEDIFF is any multiple of seven up to 84 days.

Not familiar with VBA, but I can edit (paste) like nobody's business. :eek:D
 
A starting point:
Code:
intDateDiff = Me!txtToDate - Me!txtFromDate
If intDateDiff > 84 Or (intDateDiff Mod 7) <> 0 Then
  MsgBox "wrong date diff"
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top