Checking the deadline

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?
 
S

Stefan_889_12

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
 
V

Vin Antonello

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top