Checking the deadline

  • Thread starter Thread starter Vin Antonello
  • Start date Start date
V

Vin Antonello

I have a form (based on table batches) and subform (based on table ads) and I
need that when i enter a new ad on the system it checks on another table
(deadlines) if the ad is not late.

The deadlines table has 2 rows, section and deadline (as each section has
it's own deadline)

Can you help me?
 
Hello,

one option could be use function Dlookup.

Private Sub fldNewAd_BeforeUpdate(Cancel As Integer)
strResult = DLookup("deadline", "tbldeadline", "[section]=[fldNewAd]")
If IsNull(strResult) Then
MsgBox "NoValue"
Else: MsgBox (strResult)
End If

End Sub
 
Thanks Stefan! That worked, i'm seeing the msgbox, but I still need some help

I have four deadlines, Thursday, Friday, Monday11 and Monday15

I need a code to check if the ad was batched after the deadline (the batches
are only booked on thurday, friday and monday and the last batching day is
monday).

something like
if deadline = monday15 and today=monday and time>15:00 then "late"
else "ok"
if deadline = monday11 and today=monday and time>11:00 then "late"
else "ok"
if deadline = friday and today=monday then "late"
elseif deadline =friday and today=friday and time>15 then "late"
else "ok"
if deadline =thursday and today <>thursday then "late"
elseif deadline = thursday and today=thursday and time>15 then "late"


I know i can do this with a case, but I dont know how!

Stefan_889_12 said:
Hello,

one option could be use function Dlookup.

Private Sub fldNewAd_BeforeUpdate(Cancel As Integer)
strResult = DLookup("deadline", "tbldeadline", "[section]=[fldNewAd]")
If IsNull(strResult) Then
MsgBox "NoValue"
Else: MsgBox (strResult)
End If

End Sub



Vin Antonello said:
I have a form (based on table batches) and subform (based on table ads) and I
need that when i enter a new ad on the system it checks on another table
(deadlines) if the ad is not late.

The deadlines table has 2 rows, section and deadline (as each section has
it's own deadline)

Can you help me?
 
Back
Top