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

Home Posts Topics Members FAQ

Record Sets

Hi,

Is there a way for me to determing if a column exists in the table? ex. I
have RS("var"), where RS is a recordset. My code is dynamic but some tables
will have "var" while some won't.

Thanks for the help
Shahid
Jul 22 '05 #1
3 1113
"Shahid Juma" wrote ...
Is there a way for me to determing if a column exists in the table? ex. I
have RS("var"), where RS is a recordset. My code is dynamic but some tables will have "var" while some won't.


Hello Shahid,

You didn't mention which database you were using, it might not make any
difference, but with SQL Server you could query the system objects to find
out columns that are within a table, I believe you could also get the data
types and lengths.

This article might give you something you want in a very raw manner:

http://www.4guysfromrolla.com/webtech/112900-1.shtml

You could simply iterate through the rs.fields and check for the existance
of your field...

When you pop the variable after the RS you don't need the quotes either, so
you'd have:

RS(strField)

(I believe)..

Regards

Rob
Jul 22 '05 #2

"Shahid Juma" <sh************ *****@hotmail.c om> wrote in message
news:uK******** ********@tk2msf tngp13.phx.gbl. ..
Hi,

Is there a way for me to determing if a column exists in the table? ex. I
have RS("var"), where RS is a recordset. My code is dynamic but some tables will have "var" while some won't.

Thanks for the help
Shahid


For x = 0 to RS.Fields.Count - 1
If RS.Fields(x).Na me = strTheName Then
'code to execute if the the column exists
End If

Next
Jul 22 '05 #3
Thanks,

Is there a direct method that could check, ie. exists? Using what you have
below somehow makes my rest of the fields not output.

Shahid

"Hal Rosser" <hm******@bells outh.net> wrote in message
news:5n******** ***********@big news5.bellsouth .net...

"Shahid Juma" <sh************ *****@hotmail.c om> wrote in message
news:uK******** ********@tk2msf tngp13.phx.gbl. ..
Hi,

Is there a way for me to determing if a column exists in the table? ex. I have RS("var"), where RS is a recordset. My code is dynamic but some

tables
will have "var" while some won't.

Thanks for the help
Shahid


For x = 0 to RS.Fields.Count - 1
If RS.Fields(x).Na me = strTheName Then
'code to execute if the the column exists
End If

Next

Jul 22 '05 #4

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

Similar topics

5
14915
by: Derek Cooper | last post by:
I hope you can help me. I posted this in the microsoft sql server newsgroup a few days ago and got no response so I thought I'd try here. If I can provide any clarification I'll be glad to do so. I'm trying to calculate a column based on the value of the previous record. I'm not very experienced with SQL-Server. I'm using the following...
15
4645
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any field to start. If I edit that field and then click on the new record button in the navigation buttons, the form goes to a new record and each field...
1
1722
by: David | last post by:
Hi, I have a continuous form based on a query. Lets say the form displays 6 records. I also have a button against each record which sets a field to Y or N for each record. I am trying to copy partial fields only for those records where the field = Y
0
2677
by: RL | last post by:
Hi, I am trying to implement a few functions in Plpython (in Postgresql 8.0.1). However, I could find the solution in the documentation, so I would appreciate your help. My question is how to return a record and sets of records in Plpython if it's possible. For instance, if we have a table name EMP CREATE TABLE EMP ( name text, salary...
0
1327
by: Marcelo | last post by:
Hi, I have the following need: I list a table from an access database but cannot interact with each record. At the html page I display all records, one field (field1) from and 3 buttons for each record so to: Button 1) Accept: Sets 1 on field 2 on that record Button 2) Reject: Sets 0 on field 2 on that record Button 3) Delete: Deletes that...
2
2422
by: Mark Reed | last post by:
Hi All, I have created a multi-user application at work which is working perfectly apart from a small problem which I believe to more a of a user issue (maybe some will set me straight on that one). I have set the 'Default Record Locking' option to 'Edited Record' in the hope that if someone tries to edit a record someone has open, they would...
19
2770
by: Genalube | last post by:
I have an application that will produce a Word document based on five separate queries this has required that I create a ADODB connection: 'Create connection to current database Dim Conn As ADODB.Connection Set Conn = CurrentProject.Connection There are five separate recordSets, one for each query. The record sets each fill out a...
3
16009
by: Kosmos | last post by:
Hey ya'll...I can't seem to figure out why I'm getting this error message, but it all started when I added the new line of code with the recSet5.AddNew --- when I ran the first line, the logic worked and the fields were populated properly, when I added all the rest, it wouldn't run and even when I tried to go back, it still won't run now...I am...
1
2328
by: jmarcrum | last post by:
Hello all! i have a “monitor-type” program, where my program recognizes my defined "commands”, and executes the given command, or produces an error message that says “unrecognized command”. After execution or error message, the program puts the cursor on the next line, and waits for the next command. i have two commands that I CANNOT SEEM...
19
4008
by: emanning | last post by:
Using Access 2003 and using a form that's mostly bound. I need a way to tell if user-1 is on the record when user-2 tries to open the same record, w/o waiting for the user-1 to save the record first. The only way I can think of is by adding a flag to the record and setting it to true when user-1 opens the record. If user-2 tries to open it,...
0
7411
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
7669
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. ...
0
7926
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...
1
7439
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
5987
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
5343
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
4962
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3468
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
1028
muto222
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.