473,545 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB6/ADO/SQL Server -- Error 3265 : Item not found in this collection ...

1 New Member
Hi,
I'm using ADO 2.8 in VB6 to use an SQL Server 2000 database.

This works:
Dim MyRS2 As New ADODB.Recordset
MySQL = "Select * from table1"
MyRS2.Open MySQL, sqlConnection, adOpenKeyset, adLockOptimisti c
If MyRS2.Supports( adAddNew) Then
'With MyRS2
' .AddNew
' .Fields("Record number") = "12347"
' .Fields("COMPLE TE1") = "test3"
' .Update
'End With
End If
MyRS2.Close

Note: table1 is empty.

The following gives me the nasty 3265 error. Microsoft must assume we only have one-column tables so it does need to tell us what the offending name is!
Dim avarFldNames As Variant
Dim avarFldValues As Variant
Dim a1() As String, a2() As String

ReDim a1(1)
ReDim a2(1)
a1(1) = "Record number"
a2(1) = "12347"

avarFldNames = a1
avarFldValues = a2

Dim MySQL As String
Dim MyRS2 As New ADODB.Recordset
MySQL = "Select * from " & Me.tableNameBox
MyRS2.Open MySQL, sqlConnection, adOpenKeyset, adLockOptimisti c

If MyRS2.Supports( adAddNew) Then
MyRS2.AddNew avarFldNames, avarFldValues
End If
MyRS2.Close

I've tried doing a1(0) = "Record number" and a2(0) = "12347" --> same error

Any suggestions?

I need to fill hundreds of column/fields in the table, so hoping to use the array method. Am I correct in assuming that the array way would execute faster than the first way?

By the way, I haven't seen a decent example of using this array technique.


Thanks in advance,
--Mark
Feb 4 '08 #1
2 5990
ck9663
2,878 Recognized Expert Specialist
i think this is more of a scripting question than a sql-server question. you might want to ask assistance on the scripting/web development/languages forum...

-- ck
Feb 5 '08 #2
debasisdas
8,127 Recognized Expert Expert
Are you sure the fields exists in the table and are spelled correctly.
Feb 5 '08 #3

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

Similar topics

2
10282
by: Lee Stafford via AccessMonster.com | last post by:
I get this error message when I type in a new value. The code behind this combo box is: Private Sub City_NotInList(NewData As String, Response As Integer) Response = Append2Table(Me!, NewData) End Sub
2
2186
by: Sam Shaw | last post by:
I have been looking after an MS Access database, using table links to access data in a back-end MDB database. We have recently micrated to a SQL Server 2000 back-end atabase, once again accessing it though table links. I am comfortable with the data side of things (whether through table links or an adodb.recordset). What I am missing,...
1
26968
by: Sivasenthil | last post by:
With the Runtime error above , I get the following message" Item cannot be found in the collection corresponding to the requested name or ordinal" Is this application specific or a common VB error? Any suggestions to resolve this problem?
6
29833
by: darkhat01 | last post by:
I am getting a Run-Time error '3265': Item cannot be found in the collection corresponding to the requested name or ordinal. The Function call I am using is: =getNextLastActivityDataPlanReviewScore(,"Review","TARGET_DATE","InitialScore") I think that is has something to do with sReturn = rst("sScore") in my function. But I am not 100%...
1
3894
by: wassimdaccache | last post by:
Hello Please help me I working on database using access 2003 I'm writing into a save bottom on a form this code to insert some of my value on another table ...no relationship between them If (CustomerID <> "") Then Dim stcriteria As String stcriteria = "= " & Dim myrs As Recordset
3
3300
by: DGNinja12 | last post by:
I get this error when i run, i cant figure out what is wrong Can some one please help me? Run-time error '3265': Item cannot be found in the collection corresponding to the requested name or ordinal. Below is my code Private Sub Form_Load()
16
3537
by: zandiT | last post by:
hello i'm using the microsoft audit trail example ACC2000: How to Create an Audit Trail of Record Changes in a Form and im having a problem with my recordset. in the example they are using a bound form so the text box called tbAuditTrail has a control source of the AuditTrail field in the table. My form is unbound. i tried to conncet my...
0
1727
nurikoAnna
by: nurikoAnna | last post by:
Dim rsFaculty As New ADODB.Recordset Dim rsDepartment As New ADODB.Recordset Dim oCm As New ADODB.Command Private Sub Disconnect() connect.Close End Sub
8
6284
by: charli | last post by:
Error 3265, "Item cannot be found in the collection corresponding to the requested name or ordinal" code programatically opens a query using ADOX and changed the sql Dim cat As New ADOX.Catalog Dim cmd As New ADODB.Command cat.ActiveConnection = CurrentProject.Connection Set cmd = cat.Procedures("qryLostCostCodes").Command 'opens...
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.