473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Linked Table To SQL

1
My Data base code works fine with a local table "but"as soon as i Link a table to sql it's not running thru the code the same as it did before i made the move.
I first had a dbSeechanges error. I was able to get thru that.
now i am getting a [Run-Time error '3021' Either BOF or EOF is True, or the Current record has been deleted]
Can anyone help!
Here is my Code! I Will bold where the error accures
Dim connTL As ADODB.Connection
Dim rstTL As ADODB.Recordset
Dim rstTLIP As ADODB.Recordset
Dim boolC As Boolean
Dim lngLot As Long
boolCloseFlag = boolClose
Set connTL = New ADODB.Connection
Set rstTL = New ADODB.Recordset
Set rstTLIP = New ADODB.Recordset

SO = ShopOrderText
TestEquipID = TestEquipIDCombo
item = ItemText
DateV = DateText


sta1StChk = False
sta2StChk = False
sta3StChk = False
sta4StChk = False
sta5StChk = False

sta1EndChk = False
sta2EndChk = False
sta3SndChk = False
sta4EndChk = False
sta5EndChk = False


''Sub Routine Call
Set_Fields

''Sub Routine Call
Set_FieldColumns


FinTime = txtFinishTime
strOperator = OperatorText

If AddRecordPreCheck Then
If Station_Tech_Check Then
'If Station_Tech_Insert = True Then


With connTL

.Provider = "SQLOLEDB"
.ConnectionString = "Data Source=big-sis;Initial Catalog=TesterLogSQL;Integrated Security=SSPI;"

.Open
.BeginTrans
End With

With rstTLIP
Select Case .State
Case 1
.Close
End Select


textLotNumber.SetFocus
lngLot = Val(textLotNumber.Text)
strSQLLot = "SELECT * FROM tbl_TesterLog_RecordInProcess WHERE ID_From_TL = " & lngLot
.Open strSQLLot, connTL, adOpenKeyset, adLockOptimistic
End With

If checkFromInProcessForm = False Then

With rstTL
Select Case .State
Case 1
.Close
End Select
str_TL_Lot = "SELECT * FROM TesterLog WHERE ID = " & lngLot
'.Open "TesterLog", connTL, adOpenKeyset, adLockOptimistic, adCmdTable
.Open str_TL_Lot, connTL, adOpenKeyset, adLockOptimistic



Debug Happens here! [Run-Time error '3021' Either BOF or EOF is True, or the Current record has been deleted]

!DateEntered = DateText
!ShopOrder = ShopOrderText
!Part = ItemText
!TestEquipID = TestEquipID
!Quadboard_1 = Q1
!Quad_1_Serial = Q1Ser
!Quad_1_CCXID = Q1CCXID
!Quadboard_2 = Q2
!Quad_2_Serial = Q2Ser
!Quad_2_CCXID = Q2CCXID
!Quadboard_3 = Q3
!Quad_3_Serial = Q3Ser
!Quad_3_CCXID = Q3CCXID
!Quadboard_4 = Q4
!Quad_4_Serial = Q4Ser
!Quad_4_CCXID = Q4CCXID
!Quadboard_5 = Q5
!Quad_5_Serial = Q5Ser
!Quad_5_CCXID = Q5CCXID
!Quadboard_6 = Q6
!Quad_6_Serial = Q6Ser
!Quad_6_CCXID = Q6CCXID
!Quadboard_7 = Q7
!Quad_7_Serial = Q7Ser
!Quad_7_CCXID = Q7CCXID
!Quadboard_8 = Q8
!Quad_8_Serial = Q8Ser
!Quad_8_CCXID = Q8CCXID
!Adapter_1 = A1
!Adapter_1_Serial = A1Ser
!Adapter_1_CCXID = A1CCXID
!Adapter_2 = A2
!Adapter_2_Serial = A2Ser
!Adapter_2_CCXID = A2CCXID
!Adapter_3 = A3
!Adapter_3_Serial = A3Ser
!Adapter_3_CCXID = A3CCXID
!Adapter_4 = A4
!Adapter_4_Serial = A4Ser
!Adapter_4_CCXID = A4CCXID
!Adapter_5 = A5
!Adapter_5_Serial = A5Ser
!Adapter_5_CCXID = A5CCXID
!Adapter_6 = A6
!Adapter_6_Serial = A6Ser
!Adapter_6_CCXID = A6CCXID
!Adapter_7 = A7
!Adapter_7_Serial = A7Ser
!Adapter_7_CCXID = A7CCXID
!Adapter_8 = A8
!Adapter_8_Serial = A8Ser
!Adapter_8_CCXID = A8CCXID
!ConnectionResistance = Resistance
If checkFromInProcessForm And boolCloseFlag Then
!In_Process_Flag = False
!In_Process_Qty = 0
!QtyPassed = QPassed
ElseIf boolCloseFlag Then
!In_Process_Flag = False
!In_Process_Qty = 0
!QtyPassed = QPassed
ElseIf checkFromInProcessForm Then
!In_Process_Flag = True
!In_Process_Qty = QPassed
Else
!In_Process_Flag = True
!In_Process_Qty = QPassed
End If

!QtyFailed = QFailed
!Point_of_Failure = PointOfFailure
!Operator = strOperator
.MoveFirst
.Update
.Close

End With

connTL.CommitTrans

With rstTL
Select Case .State
Case 1
.Close
End Select

.Open "TesterLog", connTL, adOpenKeyset, adLockOptimistic, adCmdTable
EndCountRecords = .RecordCount
End With

'If EndCountRecords = StartCountRecords + 1 Then
' MsgBox "Record added."
' Lock_Fields True
' checkRecordSaved = True
' Station_Tech_Insert
'Else
' MsgBox "Record NOT added."
' Lock_Fields False
'End If
checkRecordSaved = True
Lock_Fields True

Else
'if not from the in process form then


With rstTL
Select Case .State
Case 1
.Close
End Select

textLotNumber.SetFocus
lngLot = Val(textLotNumber.Text)
strSQLLot = "SELECT * FROM TesterLog WHERE ID = " & lngLot
.Open strSQLLot, connTL, adOpenKeyset, adLockOptimistic


If checkFromInProcessForm And boolCloseFlag Then
!In_Process_Flag = False
!QtyPassed = QPassed
!In_Process_Qty = 0
!QtyPassed = QPassed + Val(textQuantityToDate)
ElseIf Not checkFromInProcessForm And boolCloseFlag Then
!In_Process_Flag = False
!In_Process_Qty = 0
!QtyPassed = QPassed
ElseIf checkFromInProcessForm And Not boolCloseFlag Then
!In_Process_Flag = True
!In_Process_Qty = QPassed + Val(textQuantityToDate)
ElseIf Not checkFromInProcessForm And Not boolCloseFlag Then
!In_Process_Flag = True
!In_Process_Qty = QPassed + Val(textQuantityToDate)
End If
!Operator = strOperator
.Update
'!QtyFailed = QFailed
'!Point_Of_Failure = PointOfFailure
'
.MoveFirst
.Close

End With

connTL.CommitTrans
checkRecordSaved = True
'Station_Tech_Insert
updateTechRecord
With rstTL
Select Case .State
Case 1
.Close
End Select

.Open "TesterLog", connTL, adOpenKeyset, adLockOptimistic, adCmdTable
'EndCountRecords = .RecordCount
End With


'replace this with if record updated, not added
' If EndCountRecords = StartCountRecords + 1 Then
' MsgBox "Lot updated."
' Lock_Fields True

'Else
' MsgBox "Lot NOT updated."
' Lock_Fields False
' End If


End If


SOListBox.SetFocus

rstTL.Close
connTL.Close



End If



End If

Set rstTL = Nothing
Set connTL = Nothing
Nov 9 '06 #1
1 1791
MMcCarthy
14,534 Expert Mod 8TB
Just a few things I've noticed. When and if reposting use the code indicators and indent your code. It was very hard to follow the logic.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim connTL As ADODB.Connection
  3. Dim rstTL As ADODB.Recordset
  4. Dim rstTLIP As ADODB.Recordset
  5. Dim boolC As Boolean
  6. Dim lngLot As Long
  7. boolCloseFlag = boolClose
  8. Set connTL = New ADODB.Connection
  9. Set rstTL = New ADODB.Recordset
  10. Set rstTLIP = New ADODB.Recordset
  11.  
  12. SO = ShopOrderText
  13. TestEquipID = TestEquipIDCombo
  14. item = ItemText
  15. DateV = DateText
  16.  
  17. sta1StChk = False
  18. sta2StChk = False
  19. sta3StChk = False
  20. sta4StChk = False
  21. sta5StChk = False
  22.  
  23. sta1EndChk = False
  24. sta2EndChk = False
  25. sta3SndChk = False
  26. sta4EndChk = False
  27. sta5EndChk = False
  28.  
  29. ''Sub Routine Call
  30. Set_Fields
  31.  
  32. ''Sub Routine Call
  33. Set_FieldColumns
  34.  
  35. FinTime = txtFinishTime
  36. strOperator = OperatorText
  37.  
  38. If AddRecordPreCheck Then
  39. If Station_Tech_Check Then
  40. 'If Station_Tech_Insert = True Then
  41.  
  42. With connTL
  43.  
  44. .Provider = "SQLOLEDB"
  45. .ConnectionString = "Data Source=big-sis;Initial Catalog=TesterLogSQL;Integrated Security=SSPI;"
  46.  
  47. .Open
  48. .BeginTrans
  49. End With
  50.  
  51. With rstTLIP
  52. Select Case .State
  53. Case 1
  54. .Close
  55. End Select
  56.  
  57. textLotNumber.SetFocus
  58. lngLot = Val(textLotNumber.Text)
  59. strSQLLot = "SELECT * FROM tbl_TesterLog_RecordInProcess WHERE ID_From_TL = " & lngLot  ' this is not a text field is it?
  60.  
  61. Debug.Print strSQLLot ' check the code is what you think it is
  62.  
  63. .Open strSQLLot, connTL, adOpenKeyset, adLockOptimistic
  64. End With
  65.  
  66. ' close the recordset and reset it before trying to use it again.
  67. rstTLIP.Close
  68. Set rstTLIP=Nothing
  69.  
  70. If checkFromInProcessForm = False Then
  71.  
  72. With rstTL
  73. Select Case .State
  74. Case 1
  75. .Close
  76. End Select
  77. str_TL_Lot = "SELECT * FROM TesterLog WHERE ID = " & lngLot
  78.  
  79. Debug.Print str_TL_Lot  '  check as aforementioned
  80.  
  81. .Open str_TL_Lot, connTL, adOpenKeyset, adLockOptimistic
  82.  
  83. ' try this as a debug
  84. rstTL.MoveLast
  85. rstTL.MoveFirst
  86. If rstTL.RecordCount = 0 Then
  87.     MsgBox "There are no records returned"
  88. End If
  89.  
  90. !DateEntered = DateText
  91. !ShopOrder = ShopOrderText
  92. !Part = ItemText
  93. !TestEquipID = TestEquipID
  94. !Quadboard_1 = Q1
  95. !Quad_1_Serial = Q1Ser
  96. !Quad_1_CCXID = Q1CCXID
  97. !Quadboard_2 = Q2
  98. !Quad_2_Serial = Q2Ser
  99. !Quad_2_CCXID = Q2CCXID
  100. !Quadboard_3 = Q3
  101. !Quad_3_Serial = Q3Ser
  102. !Quad_3_CCXID = Q3CCXID
  103. !Quadboard_4 = Q4
  104. !Quad_4_Serial = Q4Ser
  105. !Quad_4_CCXID = Q4CCXID
  106. !Quadboard_5 = Q5
  107. !Quad_5_Serial = Q5Ser
  108. !Quad_5_CCXID = Q5CCXID
  109. !Quadboard_6 = Q6
  110. !Quad_6_Serial = Q6Ser
  111. !Quad_6_CCXID = Q6CCXID
  112. !Quadboard_7 = Q7
  113. !Quad_7_Serial = Q7Ser
  114. !Quad_7_CCXID = Q7CCXID
  115. !Quadboard_8 = Q8
  116. !Quad_8_Serial = Q8Ser
  117. !Quad_8_CCXID = Q8CCXID
  118. !Adapter_1 = A1
  119. !Adapter_1_Serial = A1Ser
  120. !Adapter_1_CCXID = A1CCXID
  121. !Adapter_2 = A2
  122. !Adapter_2_Serial = A2Ser
  123. !Adapter_2_CCXID = A2CCXID
  124. !Adapter_3 = A3
  125. !Adapter_3_Serial = A3Ser
  126. !Adapter_3_CCXID = A3CCXID
  127. !Adapter_4 = A4
  128. !Adapter_4_Serial = A4Ser
  129. !Adapter_4_CCXID = A4CCXID
  130. !Adapter_5 = A5
  131. !Adapter_5_Serial = A5Ser
  132. !Adapter_5_CCXID = A5CCXID
  133. !Adapter_6 = A6
  134. !Adapter_6_Serial = A6Ser
  135. !Adapter_6_CCXID = A6CCXID
  136. !Adapter_7 = A7
  137. !Adapter_7_Serial = A7Ser
  138. !Adapter_7_CCXID = A7CCXID
  139. !Adapter_8 = A8
  140. !Adapter_8_Serial = A8Ser
  141. !Adapter_8_CCXID = A8CCXID
  142. !ConnectionResistance = Resistance
  143. If checkFromInProcessForm And boolCloseFlag Then
  144. !In_Process_Flag = False
  145. !In_Process_Qty = 0
  146. !QtyPassed = QPassed
  147. ElseIf boolCloseFlag Then
  148. !In_Process_Flag = False
  149. !In_Process_Qty = 0
  150. !QtyPassed = QPassed
  151. ElseIf checkFromInProcessForm Then
  152. !In_Process_Flag = True
  153. !In_Process_Qty = QPassed
  154. Else
  155. !In_Process_Flag = True
  156. !In_Process_Qty = QPassed
  157. End If
  158.  
  159. !QtyFailed = QFailed
  160. !Point_of_Failure = PointOfFailure
  161. !Operator = strOperator
  162. .MoveFirst
  163. .Update
  164. .Close
  165.  
  166. End With
  167.  
  168. connTL.CommitTrans
  169.  
  170. ' close the recordset and reset it before trying to use it again.
  171. rstTL.Close
  172. Set rstTL=Nothing
  173.  
  174. With rstTL
  175. Select Case .State
  176. Case 1
  177. .Close
  178. End Select
  179.  
  180. .Open "TesterLog", connTL, adOpenKeyset, adLockOptimistic, adCmdTable
  181. EndCountRecords = .RecordCount
  182. End With
  183.  
  184. checkRecordSaved = True
  185. Lock_Fields True
  186.  
  187. ' close the recordset and reset it 
  188. rstTL.Close
  189. Set rstTL=Nothing
  190.  
  191. Else
  192. 'if not from the in process form then
  193.  
  194. With rstTL
  195. Select Case .State
  196. Case 1
  197. .Close
  198. End Select
  199.  
  200. textLotNumber.SetFocus
  201. lngLot = Val(textLotNumber.Text)
  202. strSQLLot = "SELECT * FROM TesterLog WHERE ID = " & lngLot
  203. .Open strSQLLot, connTL, adOpenKeyset, adLockOptimistic
  204.  
  205. If checkFromInProcessForm And boolCloseFlag Then
  206. !In_Process_Flag = False
  207. !QtyPassed = QPassed
  208. !In_Process_Qty = 0
  209. !QtyPassed = QPassed + Val(textQuantityToDate)
  210. ElseIf Not checkFromInProcessForm And boolCloseFlag Then
  211. !In_Process_Flag = False
  212. !In_Process_Qty = 0
  213. !QtyPassed = QPassed
  214. ElseIf checkFromInProcessForm And Not boolCloseFlag Then
  215. !In_Process_Flag = True
  216. !In_Process_Qty = QPassed + Val(textQuantityToDate)
  217. ElseIf Not checkFromInProcessForm And Not boolCloseFlag Then
  218. !In_Process_Flag = True
  219. !In_Process_Qty = QPassed + Val(textQuantityToDate)
  220. End If
  221. !Operator = strOperator
  222. .Update
  223. '!QtyFailed = QFailed
  224. '!Point_Of_Failure = PointOfFailure
  225. '
  226. .MoveFirst
  227. .Close
  228.  
  229. End With
  230.  
  231. connTL.CommitTrans
  232. checkRecordSaved = True
  233. 'Station_Tech_Insert
  234. updateTechRecord
  235. With rstTL
  236. Select Case .State
  237. Case 1
  238. .Close
  239. End Select
  240.  
  241. .Open "TesterLog", connTL, adOpenKeyset, adLockOptimistic, adCmdTable
  242. 'EndCountRecords = .RecordCount
  243. End With
  244.  
  245. End If
  246.  
  247. SOListBox.SetFocus
  248.  
  249. rstTL.Close
  250. connTL.Close
  251.  
  252. End If
  253. End If
  254.  
  255. Set rstTL = Nothing
  256. Set connTL = Nothing
Nov 12 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
20
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
5
by: pinballjim | last post by:
Hello everyone, I'm looking for a simple way to create a local copy of a linked table. I've got a database that links about 10 tables from other databases. This works fine on my machine, but I...
5
by: deko | last post by:
How to run action query against linked table? I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table. When I attempt to run an action query against the linked table I get this...
3
by: Michael Plant | last post by:
Hello one and all. I have a stored table in my database and the form I'm using is based on a query that draws data from my stored table and a linked table. The linked table is a *.txt file. ...
5
by: b b | last post by:
I created the following code to delete all linked tables in my database (Access 200): -------------------------------------------------------- Dim tbl As TableDef Dim dbs As Database Set dbs...
4
by: Neil Ginsberg | last post by:
I have ODBC linked tables to a SQL 7 database in an A2K database. The linked tables do not have the password stored in them, so the first time the user accesses them, they need to enter the SQL...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
9
by: erick-flores | last post by:
If you have access to the database that the linked table is in, modify it there. You can't modify a linked table. Alternatively, you can import the linked table, then it won't be linked any more...
2
by: troy_lee | last post by:
What is the best way of copying all the records from a linked table into a replica table that is local on my computer? This is for development work at home where I can not access the main table. Is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.