Field Name Detection

This is a discussion on "Field Name Detection" within the Databases section. This forum, and the thread "Field Name Detection are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Oct 4th, 2005, 05:06
Junior Member
Join Date: Sep 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Field Name Detection

Hi, I have a problem.

Suppose I have one Excel file to import in the MS Access, and I will copy the content to another table.

eg. File 1:
Unit FileNum Code
a____b______c
File 2:
Unit FileNum Code

rs .....("File 2")
rstemp.....("File 1")

In VB, I will write like this:
rs.Fields("Unit") = rstemp.Fields("Unit").value
rs.Fields("FileNum") = rstemp.Fields("FileNum").value
rs.Fields("Code") = rstemp.Fields("Code").value

After that,
File 2:
Unit FileNum Code
a____b______c

But, if the File 1:
Unit2 Num Code
a_____b______c

the Field Name is different on next time, then it doesn't work, but the content is same.
How can I copy the data to File 2 even though the field name is not same,
of course, we can set
rs.Fields("Unit") = rstemp.Fields("Unit2").value
rs.Fields("FileNum") = rstemp.Fields("Num").value
rs.Fields("Code") = rstemp.Fields("Code").value

But, can the program detect the column 1, column 2, column3, like that, don't need to use field name, it still can be copied to.
Like that:
rs.Fields("Unit") = column1.value
rs.Fields("FileNum") = column2.value
rs.Fields("Code") = column2.value
Does anybody know how to do? Thanks a lot. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 4th, 2005, 07:53
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,159
Blog Entries: 7
Thanks: 27
Thanked 19 Times in 16 Posts
You can also reference fields by index number.

In your case rsFields(0), rsFields(1), rsFields(2)

Hope this helps
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
field, name, detection

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser detection IE mac jillcary JavaScript Forum 1 Aug 1st, 2007 11:28
Need javascript to set input field value field jdadwilson JavaScript Forum 3 May 9th, 2007 04:47
Object Detection RobinDeanDotCom JavaScript Forum 4 Sep 11th, 2006 18:30
ie mac detection jimz JavaScript Forum 2 Jul 27th, 2006 22:07
validate text field to db field jtesolin Classic ASP 1 Jul 18th, 2006 17:48


All times are GMT. The time now is 08:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42