Re: Message Alert



Ok i tried it this morning and still nothing. I'm inserting the code in the
OnLoad event of the form...is this right ?. Before you fall around laughing,
remember i know zip about VB....;)

"Steve Sanford" wrote:

in the near future. I tried the code you suggested but unfortunately nothing
happened....


OK, I build a table and form and tested the code. The problem was with
spaces in the names.


Here is the modified code:

'----------end code---------------
Private Sub overDue_Click()

'
'Requires: A reference set to Microsoft DAO 3.6 Object Library
'

Dim rs As DAO.Recordset
Dim strOverDue As String
Dim strSQL As String

'Fields:
'Assessment No ' (Autonumber)
'Assessment Date ' (Date)
'To be completed by ' (Date)
'Assessment Status ' (Combo Box) "Proposed" "Complete" "Overdue"

strSQL = "SELECT [Assessment Status], [To be completed by] FROM
[tbl_Main Records]"
strSQL = strSQL & " WHERE [Assessment Status] = 'Proposed' AND [To be
completed by] > #" & Date & "#"

strSQL = strSQL & " ORDER BY [To be completed by];"

' Debug.Print strSQL

'open recordset
Set rs = CurrentDb.OpenRecordset(strSQL)

'check for records
If Not rs.BOF And Not rs.EOF Then
rs.MoveLast

strOverDue = "There are " & rs.RecordCount & " overdue assessments
as of today" & vbCrLf & vbCrLf
strOverDue = strOverDue & "Please check the report"
' strOverDue = "Overdue assessments found. Please view overdue
report"

MsgBox strOverDue

End If

' cleanup
rs.Close
Set rs = Nothing

End Sub
'----------end code---------------



Let me know what happens.......

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
.



Relevant Pages

  • Re: Message Alert
    ... Here is the modified code: ... Dim strOverDue As String ... as of today" & vbCrLf & vbCrLf ...
    (microsoft.public.access.modulesdaovba)
  • Will not read If then statement on vbyes
    ... Dim findrecord As Integer ... Dim strsql As Variant ... performance" & vbCrLf & _ ...
    (microsoft.public.access.modulesdaovba)
  • Re: Event Log Query
    ... Dim gb_echo, gb_popup ... Sub s_initialize ... On Error Goto 0 ...
    (microsoft.public.scripting.vbscript)
  • RE: Allen Brownes Duplicate Record Code
    ... Dim strSql As String ... Dim rs As DAO.Recordset ... Private Sub Command24_DblClick ... Duplicate the main form record and related records in the ...
    (microsoft.public.access.formscoding)
  • Re: Eval code and AppDomains
    ... Crossing app domains and generating these assemblies ... > I needed a way to Eval this string and return a Boolean result. ... > Dim objEval As New EvalProvider ... > sb.Append("Imports System.Data" & vbCrLf) ...
    (microsoft.public.dotnet.framework.aspnet)

Loading