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

Dcount

P: n/a
Hi
I am using the following 'On Load'
It is working correctly to show me MOT's that are due and after it has found
the MOTs due it then shows me what TAX is due (from the similar code as below
attached to the On close MOT report). All working fine UNTIL there is NO MOT
due it returns to the switchboard.
How do I write the code. IF the MOT is 0 then check the Status of the TAX.

Hope this makes some sense.
MAX

Private Sub Form_Load()

Dim intStore As Integer
intStore = DCount("[id]", "[vEHICLE DETAILS]", "[MOT DUE] <=Now()")

If intStore = 0 Then

Else
If MsgBox("There are " & intStore & " uncompleted jobs" &
_
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Uncomplete MOT...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "REPORT Reminders mot", acPreview
Else

End If
End If

End Sub
May 22 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jan
Hi:

If it were me I'd create a recordset and work from there.

air code.....
dim db as database
dim rs as dao.recordset
set db=currentdb()
set rs=db.openrecordset("select * from [vehicle details] where [there is
an mot due] and [mot due]<=now()")
rs.movelast
rs.movefirst
if rs.recordcount>0 then
...code for having incomplete jobs
else
...code for having no incomplete jobs
endif

rs.close
set rs=nothing
set db=nothing

HTH

Jan

maxjake wrote:
Hi
I am using the following 'On Load'
It is working correctly to show me MOT's that are due and after it has found
the MOTs due it then shows me what TAX is due (from the similar code as below
attached to the On close MOT report). All working fine UNTIL there is NO MOT
due it returns to the switchboard.
How do I write the code. IF the MOT is 0 then check the Status of the TAX.

Hope this makes some sense.
MAX

Private Sub Form_Load()

Dim intStore As Integer
intStore = DCount("[id]", "[vEHICLE DETAILS]", "[MOT DUE] <=Now()")

If intStore = 0 Then

Else
If MsgBox("There are " & intStore & " uncompleted jobs" &
_
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Uncomplete MOT...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "REPORT Reminders mot", acPreview
Else

End If
End If

End Sub

May 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.