473,473 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

format for naming recordset field

In VB I have a recordset and want to work with specific fields.

I realize I can use an index number e.g. rst(23)but I don't like using
index numbers in case I change the underlying fields or table later.

I also realize you can use a text name of field e.g. rst!"Myfield".

But where I am having trouble is when the field has a name such as
TblProducts_Location where TblProducts is the table in which the field
"Location" resides.

How do I use that name as a recordset field?

Thank you for the help in advance.

Nov 13 '05 #1
6 2386
how about rs.Fields("My Field Name")?

Nov 13 '05 #2

Mike wrote:
In VB I have a recordset and want to work with specific fields.

I realize I can use an index number e.g. rst(23)but I don't like using
index numbers in case I change the underlying fields or table later.

I also realize you can use a text name of field e.g. rst!"Myfield".

But where I am having trouble is when the field has a name such as
TblProducts_Location where TblProducts is the table in which the field
"Location" resides.

How do I use that name as a recordset field?

Thank you for the help in advance.


Why not rst!TblProducts_Location? By the way, you don't need the
quotes, but if the column name has an embedded space, or is a reserved
word, you might need to use square brackets

rst![TblProducts_Location]

HTH

Edward

Nov 13 '05 #3
Thanks for the suggestion but it did not work. I've spent a lot of time
on this but so far unsuccessfully.

Mike S

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4
Thanks for the try but neither worked. I am probably stuck using
indices.

Mike S

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
That's funny, I use the Recordset.Fields("Field Name") syntax all the
time and it has NEVER failed. You must be doing something wrong. Post
your code so we can see it instead of guessing what you could be doing
wrong. It may not be the way you're referring to the fields in your
recordset at all. It could be something entirely different.
From my point of view, this is like asking for directions when you're

lost and never telling the person helping you what intersection you're
at. How exactly are we supposed to be able to help you without
explicit/complete information? Unless you show us your code, we cannot
read it, comment on it accurately, or fix it for you. But it's your
problem... no skin off my nose if you don't feel like sharing.

Nov 13 '05 #6
Mike <mf***@devdex.com> wrote in
news:us****************@news.uswest.net:
Thanks for the suggestion but it did not work.


Well, what error did it return?

Saying "it didn't work" doesn't give us any information to make
anything other than completely speculative suggestions for the
cause, whereas the error number and error message will narrow it
down.

From the things you report to not have worked, it seems pretty clear
to me that the field is not named what you think it is.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7

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

Similar topics

7
by: RCS | last post by:
Okay, a rather 'interesting' situation has arisen at a place I work: I need to convert a database from Access to something that can be used over the web. I am currently maintaining and...
15
by: deko | last post by:
With all due respect to Stan Leszynski and Greg Reddick, I'm still wondering how to name controls on forms in my Access MDB. Correct me if I'm wrong... If a textbox or other control on a form...
3
by: dave | last post by:
Hi there, I'm trying to extract formatting information from the columns in a database field and use it to format data bound text boxes in a VB6 application. I can't find a way to get the format...
4
by: Jack | last post by:
Hi, I have the following Access DDL statment from which I generated a access table: CREATE TABLE TEST1 (ID COUNTER, NAME TEXT(50), STORAGESPACEASSIGNED TEXT(50) )
11
by: MP | last post by:
Hi, Coming from a vb6 background I am accustomed to prefixing variable names to indicate their usage. Now just beginning to try to learn database stuff I've been lurking here and working on my...
114
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for...
5
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
5
by: The Pipe | last post by:
Hello I have a table that I need to export to a .asc file format. I have had several attempts at getting this to work but with no luck. Basically the file would need to have every record...
0
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,...
0
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...
0
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,...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.