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

Date 90 days or older. 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi there,

In my form I have a field "txtStartDate" that populates a field in my table "tblassimilation" with a date when someone receives their new job description. From that date they have 3 months to request a review this is done by ticking a check box "ReviewRequested". What I need (I think) is something in the "AfterUpdate" of "ReviewRequested" to say that the date in "txtStartDate" is 90 days or older. I have tried variations of the code below but with no success (the second half).

Private Sub ReviewRequested_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
If (Me.ReviewRequested) Then
DoCmd.OpenReport "ReportReviewLetters", acViewPreview, "", "[PAYNO]=[Forms]![FrmJedSwitchboard]![text6]"
Exit Sub
End If
If (Me.txtStartDate > 90) Then
MsgBox "Too late Ha, Ha, Ha.", vbExclamation, "Required selection"
End Sub

As always if there is an easier way to do this I would be happy to try it.
 
Thanks for that Skip,

I also need a dlookup version of this too. I have tried the following and although I get the right reading when holding the cursor over the debug line I am not getting the message box, can you see why.

Dim varX As Variant

varX = DLookup("[Assletterreceived/Posted]", "tblassimilation", "PayNumber =[Forms]![FrmJedSwitchboard]![text6]")

If (varX = Date > 90) Then

MsgBox "Too late Ha, Ha, Ha.", vbExclamation, "Required selection"
End If
 
Code:
If ([COLOR=#ff0000]varX = Date > 90[/color]) Then
   
    MsgBox "Too late Ha, Ha, Ha.", vbExclamation, "Required selection"
End If

Why is it that your test is varX = Date > 90 instead of Date > varx + 90 has your txt suggest......

Read the post correctly, I think you might be under the influence of alcool :)

regards
 
Sorry I copied that down wrong :~/

Thanks for pointing that out to me it works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top