Senin, 27 April 2015

[MS_AccessPros] active control

 

Pros, I’m collecting usage data by this code:

 

' added 4/20/15 to collect usage data

Public Sub WriteButtonInfo(ctl As Control)

   On Error GoTo err_out

   Dim db As DAO.Database

   Dim rs As DAO.Recordset

   Dim strsql As String

   Set db = CurrentDb()

   strsql = "INSERT INTO ButtonsClicked(ButtonName, ByWhom, WhenClicked) VALUES ('" & _

      ctl.Name & "', '" & GetLoginName() & "', #" & Now() & "#)"

   db.Execute (strsql), dbFailOnError

   GoTo exit_out

err_out:

   MsgBox ("Error in WriteButtonInfo " & Err.Number & vbCrLf & Err.Description)

exit_out:

   Set rs = Nothing

   Set db = Nothing

End Sub

 

I call it from the onclick event of various command buttons

 

Call WriteButtonInfo(me.activecontrol)

 

And the results are pretty good, but my confusion is a text box that I have so the form doesn’t do a weird shift on the screen that gets set when I change pages.  It’s the txtSetFocus at the bottom (provided the image page worked).

 

My question is:  Will the procedure actually write the button clicked if it is as the very top of the onclick procedure calling it?

 

ECRButtonFreq

ButtonName

CountOfID

cmdAffected

1

cmdAgenda

112

cmdAllReq

1

cmdApp7

1

cmdBrowseImage

1

cmdClosed7

1

cmdClosedECRs

18

cmdDwgHistAsk

16

cmdDWGOpen

3

cmdECOs

5

cmdECRAging

1

cmdFirstRec

4

cmdGuide

2

cmdItemsProgNSS

7

cmdLast

12

cmdMult

3

cmdNonConseq

10

cmdOCPD

1

cmdOpenDwg

17

cmdOpenDwgHistAsk

15

cmdOpenECRQ

10

cmdOpenECRs

9

cmdOpenItemHist

3

cmdOpenReq

1

cmdPaste

37

cmdPEProg

1

cmdPERptCode

24

cmdPriAge

7

cmdPriAging

1

cmdProg

2

cmdProgs

1

cmdPSECRs

1

cmdRange

4

cmdRefresh

5

cmdRemoveFilter

12

cmdRequery

56

cmdSrchDwg

2

cmdThisProg

70

cmdUpdECO

17

cmdWhoOn

17

cmdYTDECRbyReason

1

ECO

89

txtECR

2

txtProgram

6

txtSetfocus

288

 

 

Respectfully,

Liz Ravenwood

Programmer / Analyst

B/E Aerospace | Super First Class Environments

 

1851 S Pantano Road | Tucson, Arizona 85710

Office +1.520.239.4808 |

beaerospace.com

Passion to Innovate. Power to Deliver

 



This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

__._,_.___

Posted by: Liz Ravenwood <Liz_Ravenwood@beaerospace.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar