-
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
-
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
-
Obviously the variable xloc is used for debugging purposes. However, it will be more neat to use line numbers instead.
-
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.
https://www.mztools.com/v8/images/ResultWindow.png