Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

VBA: test for empty recordset; use of assistant baloon object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Clif McIrvin - 01 May 2008 00:03 GMT
Hello again <g>.

This time I'm looking for comments / suggestions as to whether I'm on
the right track or not. The code sample below is doing what I expect it
to, I'm just wondering about my coding technique.

Actually, I have at least three questions:

1 and 2. The code was working fine until I stumbled into an attempt to
exit the Remarks control with an empty recordset which threw an object
not defined error on the 'If Me.Box.Value ' line. Is my solution of
testing 'me.recordset.bof' valid from both coding style and Access / Jet
usage?

3. My use of the assistant balloon object appears to be working as I
expect; but as I was unable to find any documentation of this particular
technique I'm wondering if I'm setting myself up for future trouble.

Comments, anyone?

The form in question is actually a sub-form but I also sometimes use it
as a stand-alone form. The controls are bound; Remarks is Text and Box
is Boolean. My environment is XP Pro SP2, Access 2003 SP3 w/Hotfix using
DAO 3.6.

Begin Code Sample=============

Option Compare Database

Public myBalloon As Balloon

Private Sub Form_Load()
With Assistant
 .On = True
 .Visible = False
End With

Set myBalloon = Assistant.NewBalloon
myBalloon.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)
 Set myBalloon = Nothing
 With Assistant
   .Visible = False
   .On = False
 End With
End Sub

Private Sub Remarks_Enter()
If Me.Recordset.BOF Then    'skip all if empty recordset
ElseIf Me.Box.Value = True Then
With myBalloon
   .Text = Me!Remarks.StatusBarText
   .Mode = msoModeModeless
   .Button = msoButtonSetNone
   .Show
End With
End If
End Sub

Private Sub Remarks_Exit(Cancel As Integer)
If Me.Recordset.BOF Then    'skip all if empty recordset
ElseIf Me.Box.Value = True Then
 myBalloon.Close
End If
End Sub

End Code Sample===============

Signature

Clif
Still learning Access 2003

Arvin Meyer [MVP] - 01 May 2008 01:58 GMT
Try this:

With Me.RecordsetClone
   If Not (.EOF And .BOF) Then
       With myBalloon
       ' yada yada
       End With
   End If
End With

> Hello again <g>.
>
[quoted text clipped - 64 lines]
>
> End Code Sample===============
Clif McIrvin - 02 May 2008 00:27 GMT
> Try this:
>
[quoted text clipped - 5 lines]
>    End If
> End With

Thanks, Arvin.

I see the improvement to the self-documentation here as well as the more
particular test.

Signature

Clif
Still learning Access 2003

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.