When Hovering Isnt Enough Using the Immediate Window

There are times when having a variable's value pop up by hovering over it isn't sufficient. Perhaps the value doesn't fit in the pop-up, or maybe you need to copy the value to use it somewhere else. Or maybe you just want to look at it longer than the limited time the pop-up value displays. In these cases, you can use the Immediate Window (instead of hovering) to view variable values.

If the Immediate Window isn't already displayed, you can use Ctrl-G or select View..Immediate Window from the menu. Once you have it showing, you can ask Access to display the value of a variable using ?, like this:

?Me.BusinessKey

^H Microsoft Visual Basic - Chamber Application [break] [Form frmRusinesses (Code)]

-M

Fils Edit View Insert Debug Run Tools Add-lns Window Help

^Jffixli

H$jk> H 4® ¡6, ¡^ 10 ■

► . i ^ Iff q<§

(?) Ln 53, Col 25

Project - Chamber Application PJ

|cmdCopy

Project - Chamber Application PJ

EH Form. m Form. m Form Form. [El Form. m Form m Form. m Form. |U Form m Form. [El Form. [=11 Form

_frmBusinesses _frmMenu_About i _frmMenu_Configur _frmMenu_Main _frmMenu_Reports _frmMenu_Splash _frmMenu_UserTips _frmReport5elector. _frmWorkspace _fsubBusiness_Payr _fsubCustomize_Bla fsubCustomise r

Alphabetic ] Categorised ]

Alphabetic ] Categorised ]

|cmdCopy

"3

Dim db As Database Dim recBusiness As DAO.Recordset

Dim recPaymentFrom As DAO.Recordset -

Dim recPaymentTo As DAO.Recordset Dim IngBusinessKey As Long

If Not IsNull(He.BusinessKey) Then

Set recBusiness = ^. QpenRecordset (rrtblBusiness", dbOpenDyna dh = Nothing]

1 copy the parent record and remember its key recBus iness. AddWetr recBusiness!BusinessName = "Copy of " fi He!BusinessName recBusiness.Update recBusiness.Bookmark = recBusiness.LastHodified IngBusinessKey = recBusiness!BusinessKey at^j_I

Figure 8-7

When you press Enter, Access will return the value:

?Me.BusinessKey 949

No matter how long this value is (it could be a very long string, for example) Access will display it here so that you can study it or even copy it into the clipboard to use somewhere else. This comes in very handy when the variable contains a long SQL string that you want to try out by pasting it into a new query.

0 0

Post a comment