Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Creating an "AttachEvent" to send msgbox

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,36450
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating an "AttachEvent" to send msgbox
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Creating an "AttachEvent" to send msgbox - 7/24/2006 5:32:10 AM   
  zeg37

 

Posts: 15
Score: 0
Joined: 6/16/2006
Status: offline
Hi,
 
I am working with a Microsoft Data Page where the records are filtered by two dates the user selects prior to any records being loaded.  After selecting dates they click on a button (BtnGo) to fire the filter event.  Currently if no records are found that match the criteria, the page just remains empty.  I would like the user to receive a message if no records are found for the dates provided.   I've spent a lot of time attempting to add a clause to my IF…Then statement but finally figured out that logically it wouldn’t work. 
 
What I’m attempting to do now is use “AttachEvent” with my “onclick” event to send a message if a sum field is empty after the records are filtered (which would be the case if no records were found).  I’ve cobbled together code for an AttachEvent based on what I’ve found on the internet; although without any clear directions, I’m not sure if I’ve even remotely written it correctly.  As currently written, I receive an error message when I open the page that an object is required.  I’ve tried both “BtnGo” and “onclick” as my object and received the same error message for both.
 
I would certainly appreciate any suggestions for correcting my code or a head’s up if "AttachEvent" won’t work.
 
Thanks!
Zeg
 
<SCRIPT language=vbscript>
 
Sub OnFilterComboChange()
Dim stWhere
'Don't do anything unless user selects a value from each list box.
If (FromMondayDate.value <> "" and ToSundayDate.value <> "") Then
   stWhere = "CrewTime.CrewDate>=" & "#" & FromMondayDate.value & "#" & " "
   stWhere = stWhere & "AND CrewTime.CrewDate<=" & "#" & ToSundayDate.value & "#"
   stWhere = stWhere & "AND CrewTime.DataCollectorHours<>" & " 0.0"
           
  'Set the server filter on the CrewTime Recordset.
   MSODSC.RecordsetDefs.Item("CrewTime Other Hours Query").ServerFilter = stWhere
End If
End Sub
</SCRIPT>
 
<SCRIPT language=vbscript event=onclick for=Btngo>
<!--
OnFilterComboChange()
-->
</SCRIPT>
 
 
<SCRIPT language=vbscript>
<!--
dim Check
set Check = getRef("CheckTotal")
Btngo.attachCheckTotal Check
 
sub CheckTotal()
            if OtherHours0.value = "" Then
                        msgbox "No records for dates provided."
            End if
End sub
-->
</SCRIPT>
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating an "AttachEvent" to send msgbox Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts