By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,968 Members | 1,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,968 IT Pros & Developers. It's quick & easy.

What's Wrong with this CODE??

100+
P: 132
If [Forms]![DateRange]![FrmRptDate] Is Null Then

MsgBox "Please enter a valid FROM Date", vbCritical, "Input Date Range"

End If

Access does not like it...Keep getting an OBJECT REQUIRED message.

Also, Can I use something like this to determine if one date is greater than the other??

If [RptFrmDate] > [RptToDate]
Jan 30 '08 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,679
If [Forms]![DateRange]![FrmRptDate] Is Null Then

MsgBox "Please enter a valid FROM Date", vbCritical, "Input Date Range"

End If

Access does not like it...Keep getting an OBJECT REQUIRED message.

Also, Can I use something like this to determine if one date is greater than the other??

If [RptFrmDate] > [RptToDate]
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Forms!DateRange![FrmRptDate]) Then
  2.   MsgBox "Please enter a valid FROM Date", vbCritical, "Input Date Range"
  3. End If
Jan 31 '08 #2

100+
P: 132
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Forms!DateRange![FrmRptDate]) Then
  2.   MsgBox "Please enter a valid FROM Date", vbCritical, "Input Date Range"
  3. End If
That works....How can I keep the access at that point in the code until a value is entered?? (in other words it will continue to check for a null value.)
Jan 31 '08 #3

100+
P: 132
That works....How can I keep the access at that point in the code until a value is entered?? (in other words it will continue to check for a null value.)

Along those lines....How about this code....?? Nothing seems to happen when executed?

If (Forms!DateRange![FrmRptDate]) >= (Forms!DateRange![ToRptDate]) Then
MsgBox "Please enter a valid Date Range", vbCritical, "Input Date Range"
End If
Jan 31 '08 #4

ADezii
Expert 5K+
P: 8,679
Along those lines....How about this code....?? Nothing seems to happen when executed?

If (Forms!DateRange![FrmRptDate]) >= (Forms!DateRange![ToRptDate]) Then
MsgBox "Please enter a valid Date Range", vbCritical, "Input Date Range"
End If
  1. Are the Control Sources for the [FrmRptDate] and [ToRptDate] Fields defined as Date and not String?
  2. Are there entries in both Fields?
  3. If entries exist in both Fields, are they valid Dates?
Feb 1 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.