473,782 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recordset addnew etc...

I have a question regarding how i can refer to the fields that I want
to add into my dataset

Each of my fields in my rawtext file that I am going to import appears
in the form:

"FieldName:Fiel dValue"

with a comma between each ietm in a record.

I'm happy about dividing it all up but I want to do something like
this...

rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update

So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.

incnt contains the the count of fields in a particular row.

The reason for this idea is that i might only get some of the total
possible fields in my data record...

I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...

What is the correct form - if any?

Thanks,

Rob.

Sep 25 '07 #1
5 2341
Anyone? I've tried loads of ideas but it's not getting me anywhere.

I've tried:

rs1![myarray(1,i)] = myarray(2,i)

rs1!(myarray(1, i)) = myarray(2,i)

rs1!("myarray(1 ,i)") = myarray(2,i)

it's driving me mad - what am i doing wrong?

Thanks,

Rob.

On 25 Sep, 13:06, dkintheuk <rmcgre...@fire net.uk.comwrote :
I have a question regarding how i can refer to the fields that I want
to add into my dataset

Each of my fields in my rawtext file that I am going to import appears
in the form:

"FieldName:Fiel dValue"

with a comma between each ietm in a record.

I'm happy about dividing it all up but I want to do something like
this...

rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update

So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.

incnt contains the the count of fields in a particular row.

The reason for this idea is that i might only get some of the total
possible fields in my data record...

I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...

What is the correct form - if any?

Thanks,

Rob.

Sep 25 '07 #2
On Sep 25, 7:06 am, dkintheuk <rmcgre...@fire net.uk.comwrote :
I have a question regarding how i can refer to the fields that I want
to add into my dataset

Each of my fields in my rawtext file that I am going to import appears
in the form:

"FieldName:Fiel dValue"

with a comma between each ietm in a record.

I'm happy about dividing it all up but I want to do something like
this...

rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update

So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.

incnt contains the the count of fields in a particular row.

The reason for this idea is that i might only get some of the total
possible fields in my data record...

I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...

What is the correct form - if any?

Thanks,

Rob.
I'm still not clear on exactly what you are trying to do... You have
a comma-delimited text file and you want to import it. What method
are you going to use to import it? You could open it with the OPEN
command and read it one line at a time until you reach its EOF. If
you are unsure if all of the possible fields will be represented, then
you could use a switch statement to select the proper field or
rs.fields("fiel dname"), replacing "fieldname" with the variable
holding the fieldname. I don't know what you are trying to do with
the array...

Sep 25 '07 #3
On 25 Sep, 14:38, OldPro <rrossk...@sbcg lobal.netwrote:
On Sep 25, 7:06 am, dkintheuk <rmcgre...@fire net.uk.comwrote :


I have a question regarding how i can refer to the fields that I want
to add into my dataset
Each of my fields in my rawtext file that I am going to import appears
in the form:
"FieldName:Fiel dValue"
with a comma between each ietm in a record.
I'm happy about dividing it all up but I want to do something like
this...
rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update
So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.
incnt contains the the count of fields in a particular row.
The reason for this idea is that i might only get some of the total
possible fields in my data record...
I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...
What is the correct form - if any?
Thanks,
Rob.

I'm still not clear on exactly what you are trying to do... You have
a comma-delimited text file and you want to import it. What method
are you going to use to import it? You could open it with the OPEN
command and read it one line at a time until you reach its EOF. If
you are unsure if all of the possible fields will be represented, then
you could use a switch statement to select the proper field or
rs.fields("fiel dname"), replacing "fieldname" with the variable
holding the fieldname. I don't know what you are trying to do with
the array...- Hide quoted text -

- Show quoted text -
It's not the import that is the problem i can go from a text file that
looks like this...

Fieldname1:Fiel dValue1,FieldNa me2:FieldValue2 ,FieldName3:Fie ldValue3

Each row can contain any number of records but i have the full set of
possible fieldnames...

I'm converting this to an array myarray(a,b)

a is always 1 or 2 and this relates to fieldname or fieldvalue

So then I can call the fieldnames with myarray(1,b) and the
fieldvalues with myarray(2,b)

I'm gonna try what you mentioned rs.fields(myarr ay(1,b)) and see how
far i get.

Thanks,

Rob.

Sep 25 '07 #4
On 25 Sep, 14:38, OldPro <rrossk...@sbcg lobal.netwrote:
On Sep 25, 7:06 am, dkintheuk <rmcgre...@fire net.uk.comwrote :


I have a question regarding how i can refer to the fields that I want
to add into my dataset
Each of my fields in my rawtext file that I am going to import appears
in the form:
"FieldName:Fiel dValue"
with a comma between each ietm in a record.
I'm happy about dividing it all up but I want to do something like
this...
rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update
So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.
incnt contains the the count of fields in a particular row.
The reason for this idea is that i might only get some of the total
possible fields in my data record...
I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...
What is the correct form - if any?
Thanks,
Rob.

I'm still not clear on exactly what you are trying to do... You have
a comma-delimited text file and you want to import it. What method
are you going to use to import it? You could open it with the OPEN
command and read it one line at a time until you reach its EOF. If
you are unsure if all of the possible fields will be represented, then
you could use a switch statement to select the proper field or
rs.fields("fiel dname"), replacing "fieldname" with the variable
holding the fieldname. I don't know what you are trying to do with
the array...- Hide quoted text -

- Show quoted text -
In fact i can already tell you that it works perfectly - i just
couldn't get the syntax right to refer correctly to the fieldname in
the recordset rs1 by a variable - that has sussed it.

CHeers,

Rob.

Sep 25 '07 #5
On Tue, 25 Sep 2007 06:27:55 -0700, dkintheuk
<rm*******@fire net.uk.comwrote :

rs1.Fields(myar ray(1,i)) = myarray(2,i)

-Tom.

>Anyone? I've tried loads of ideas but it's not getting me anywhere.

I've tried:

rs1![myarray(1,i)] = myarray(2,i)

rs1!(myarray(1 ,i)) = myarray(2,i)

rs1!("myarray( 1,i)") = myarray(2,i)

it's driving me mad - what am i doing wrong?

Thanks,

Rob.

On 25 Sep, 13:06, dkintheuk <rmcgre...@fire net.uk.comwrote :
>I have a question regarding how i can refer to the fields that I want
to add into my dataset

Each of my fields in my rawtext file that I am going to import appears
in the form:

"FieldName:Fie ldValue"

with a comma between each ietm in a record.

I'm happy about dividing it all up but I want to do something like
this...

rs1.AddNew
For i = 1 To intCnt
rs1!(myarray(1, i)) = myarray(2, i)
Next
rs1.Update

So myarrary(1,i) contains the fieldname and myarray(2,i) contains the
contents.

incnt contains the the count of fields in a particular row.

The reason for this idea is that i might only get some of the total
possible fields in my data record...

I know that i can refer to the fieldname by name but here i tried to
use a variable instead and it just doesn't want to know...

What is the correct form - if any?

Thanks,

Rob.
Sep 25 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1967
by: Rob Meade | last post by:
evenin' k - I've got a recordset that I'm dumping another recordset into - because the source comes from a database that I cant update (probably makes more sense to me that bit) - anyway, I need to update the new recordset which I can do...I think however that I have missed something, as later in my code it only seems to iterate once, and there should be at least 2 rows in the recordset... Can anyone confirm that when I use something...
0
1532
by: belacyrf | last post by:
Here's the code: ------------------------------------------------------------------- accessID = request("accessID") strSQL = "SELECT * From PendingAccRequests Where AccessID = "&accessID 'Create the Recordset object and run SQL statement Set accRS = Server.CreateObject ("ADODB.Recordset") accRS.Open strSQL, objConn
11
11560
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a continuous (and datasheet) form. I needed it for a data entry subform and I haven't been able to get it to work. Is there any rational for why it doesn't work with a subForm? Any suggestions for a datasheet data entry subform with two...
2
15580
by: Harold | last post by:
Sat I have a customers table with the fields CustomerID and Customer and I use the recordset.addnew method to add a new record to the table. What is the best way to get the CustomerID of the new record after recordset.update is executed? Recordset!CustomerID doesn't work because the recordset bookmark is on the first record. Moving to the last record doesn't work if the recordset is based on a query and the recordset is sorted. Thanks! ...
13
3482
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the query: QryICTMassDistribution3) , I then use a form and the code below to create a new record in the corrispondence table to show what corrispondence has been sent to various companies.
5
6443
by: Fabrice | last post by:
Hello everybody, I'm working with Access 2002. I have to import Data from a Foxpro table that contains 25000 records in an Access table. I have a couple of restrictions placed on me for the solution: 1. I am not allowed to use ODBC 2. I have to use ADO 3. I am not allowed to use Linked tables
5
25462
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew Adodc1.Recordset.Update Adodc1.Recordset.MoveFirst Adodc1.Recordset.MoveNext Adodc1.Recordset.Delete
4
11563
by: darkforcesjedi | last post by:
Creating a connectionless recordset in ADO is simple enough, but how do you do it in DAO? I want a recordset stored in memory so I can filter/sort it easily. If I create a table I can make it work, but I don't want to have to read/write everything from/to disk every time I need to use the data. I tried: Dim r As DAO.Recordset, tdf As DAO.TableDef
0
9006
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the Recordset? Does the Recordset support Bookmarks? Can we use the Find and/or Seek Methods with this Recordset? Does the Recordset support the use of Indexes? Will the Absoluteposition property be able to be used on this Recordset? etc....
2
2115
by: Kamil | last post by:
Hi. Is it possible to add new record to my recordset which is based on a query? I want to use this recordset only for temp starage of data, and I don't want to update values from this recordset to a table. Code: Q2 = "SELECT T_SMP_RCNR.KEY_ORDER, T_SMP_RCNR.RCNR, T_SMP_RCNR.KEY_RCNR " & _ "FROM T_SMP_RCNR LEFT JOIN Q_MaxOfSMPRCNR ON
0
9479
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7492
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
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
3
2874
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.