Consulting

Results 1 to 4 of 4

Thread: xloc in access VBA code

  1. #1

    xloc in access VBA code

    I inherited an access database with extensive programming. Much of it I now understand. I continue to be baffled by the use of xloc in the code. Below is some code associated with a form. Any thoughts on what xloc is doing?

    Private Sub Command52_Click()
    On Error GoTo Err_Command52_Click
    DoCmd.Close


    Dim rdt As ADODB.Recordset
    Dim rda As ADODB.Recordset
    Dim scht As String, xloc, ss1, ss2, ss3, ss4, ss5, sdoc, xaptnt
    Dim xnext As Long
    Dim xtenant As Long
    Dim xlatefee As Double

    ' ********************************************************


    xloc = "A1"
    Set rdt = New ADODB.Recordset
    rdt.Open "TSEARCH3B", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

    Set rda = New ADODB.Recordset
    rda.Open "DCCASE", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

    Do While Not rdt.EOF

    xloc = "A1a"
    ss1 = "CaseNo = '" & rdt!CaseNo & "'"
    rda.Filter = ss1
    If rda.EOF Then
    Else

    rda!County = "DC"
    xloc = "A1b"
    rda!NoMoArrears = rdt!NoMoArrears
    rda!MonthlyRent = rdt!MonthlyRent
    If IsNull(rdt!RentDate) Then
    Else
    rda!RentDate = rdt!RentDate
    End If
    rda!AttCode = rdt!AttCode
    xloc = "A1c"
    rda!TenantComments = rdt!TenantComments
    rda!TenantComment2 = rdt!TenantComment2
    rda!TenantComment3 = rdt!TenantComment3
    rda!Tenant1 = rdt!Tenant1
    rda!Tenant2 = rdt!Tenant2
    rda!Tenant3 = rdt!Tenant3
    rda!Tenant4 = rdt!Tenant4
    xtenant = 0

  2. #2
    Just answered my own question. xloc is used in the error handler:

    Err_Command52_Click:
    MsgBox Err.Description & " " & xloc
    Resume Exit_Command52_Click

    End Sub

  3. #3
    Obviously the variable xloc is used for debugging purposes. However, it will be more neat to use line numbers instead.

  4. #4
    TIP: Use Find and Find Next

    TIP2: Get MZTools (click here). The enhanced find in this tool is great. It would be worth it for this one feature. It will list every line where the text exists. Like Bystander suggested, It will also Add / Remove Line Numbers.

    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •