Yeah. This only hangs from immediate window so far I can tell.
Code:
Function tableRead(strTable, strField, strWhere, strEqualsValue, intRow)
'* This lovely function will read a table and return a value
' Table Name, SelectONEField, WhereField, EqualsValue, Row
'-- OR ("DirectSQL",SQL Statement,,,intRow)
pXname = "tableRead"
pXStack = Left(pXStack, 500) & ">" & pXname
On Error GoTo err_hand
Dim vRows As Variant
Dim strSQL, strSQL1, strSQL2, strSQL3, strSQL4, strSQL5, strSQL6 As String
Dim cn4 As ADODB.Connection
Set cn4 = CurrentProject.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
'****Argument Checker
If (strTable = "DirectSQL") Or (strTable = "SQLDirect") Then '*Direct SQL Mode
intdirect = 1
GoTo sKip1
End If
If IsMissing(strTable) = True Then
Call CStatus("No arguments specified", 408)
Exit Function
End If
If IsMissing(strField) = True Then
Call CStatus("Missing strField", 408)
Exit Function
End If
If IsMissing(strWhere) = True Then
Call CStatus("Missing strWHERE", 408)
Exit Function
End If
If IsMissing(strEqualsValue) = True Then
Call CStatus("Missing strEqualsValue", 408)
Exit Function
End If
If IsMissing(intRow) = True Then
Call CStatus("Missing IntRow", 408)
Exit Function
End If
sKip1:
'cn4 = Nothing
'Skip Opening CN if it's already open!
sKip1b:
If (intdirect = 1) Then
strSQL = strField
GoTo sKip2
End If
'* SQL SET
strSQL1 = "SELECT" & " "
strSQL2 = strField & " "
strSQL3 = "FROM" & " "
strSQL4 = strTable & " "
strSQL5 = "WHERE" & " "
strSQL6 = strTable & "." & strWhere & "="
strSQL7 = "" & strEqualsValue & ""
strSQL = strSQL1 & strSQL2 & strSQL3 & strSQL4 & strSQL5 & strSQL6 & strSQL7 & ";"
sKip2:
rs.Open strSQL, cn4, adOpenDynamic, adLockOptimistic
err_Res:
vRows = rs.GetRows
rs.Close
Set rs = Nothing
cn4.Close
Set cn4 = Nothing
If (vRows(0, intRow) = Null) Then vRows(0, intRow) = -1
tableRead = vRows(0, intRow)
Exit Function
err_hand:
Select Case Err.Number
Case 9: 'Record X not found
'call CStatus("Record X not found.", 308) 'Disabled 12-18 d/t too many records produced
tableRead = -1
Exit Function
Case 3021:
tableRead = ""
Call CStatus("No records found", 309)
tableRead = -1
Exit Function
End Select
Call CStatus("Other error:", 539, Err.Number, Err.description, strSQL)
End Function
Code:
tagNo |
room |
zone |
zone1 |
container |
owner |
contents |
category |
description |
s |
1 |
7 |
7 |
6 |
2 |
0 |
1 |
Initial Record |
l5j |
9 |
12 |
12 |
2 |
2 |
0 |
15 |
mixxed bag from cleanup of bedroom and/or murano Dec 18 2013, is there tape in there? Not hanging but stuck to right of bed. |
l22v |
9 |
9 |
9 |
2 |
2 |
0 |
21 |
unknown lot - Update: Bag is falling apart, re-inenvory ASAP |
l19f3 |
2 |
1 |
1 |
2 |
2 |
0 |
2 |
bras, etc |
131122B |
1 |
1 |
1 |
2 |
7 |
0 |
10 |
video games, dvds, etc |
l19f4 |
1 |
1 |
1 |
2 |
2 |
0 |
21 |
part out, re-sort |
l22t |
9 |
10 |
10 |
5 |
3 |
0 |
13 |
quilt, etc |
l22k |
9 |
0 |
0 |
1 |
2 |
0 |
21 |
Stuff from Ron's trailer |
l22h |
9 |
11 |
11 |
5 |
4 |
0 |
2 |
do NOT sale, first clothes! |
l22r |
14 |
18 |
18 |
2 |
4 |
0 |
1 |
|
l22n |
9 |
18 |
18 |
2 |
4 |
0 |
1 |
|
l20w |
14 |
18 |
18 |
2 |
4 |
0 |
1 |
Toys |
l24f |
9 |
11 |
11 |
1 |
2 |
0 |
8 |
error in initial record, this box contains these items. Mil trg certificate, some of Sherrys jewry. |
l24v |
9 |
0 |
0 |
1 |
3 |
0 |
17 |
DVDs |
l24u |
9 |
11 |
11 |
1 |
3 |
0 |
17 |
music CDs |
l24r |
9 |
32 |
32 |
1 |
3 |
0 |
8 |
re-audit. Curios, need internal picture. Box says CD' but has another label #. |
l24q |
9 |
0 |
0 |
5 |
3 |
0 |
1 |
stuffed animals |
l24j |
9 |
11 |
11 |
1 |
2 |
0 |
21 |
Some photos in here too, investigate and scan photos. |
l22w |
10 |
0 |
12 |
1 |
7 |
0 |
16 |
X-Mas, stuff not used 2013. LED B/W, Incandesant gold, bulbs, silver and white beads. NO GOLD ornaments :( |
l24x |
9 |
0 |
0 |
1 |
2 |
0 |
17 |
scan in? photo albums, etc |
l24b |
9 |
11 |
11 |
1 |
2 |
0 |
9 |
Stuff from Rons etc |
l22j |
9 |
10 |
10 |
1 |
7 |
0 |
4 |
kitchen stuff, containers, serving platters, gadgets - reaudited |
l24m |
9 |
0 |
0 |
1 |
2 |
0 |
4 |
RE-PACK ASAP. glasses, pending re-pack. A similar lot fell and two glasses busted. |
l24s |
9 |
11 |
11 |
1 |
4 |
0 |
1 |
matchbox cars, 3 boxes full of them! |
l22d |
9 |
11 |
11 |
1 |
3 |
0 |
21 |
jenny doesn't even know whats in vcr box |