View Full Version : Deleting Fields from recored set


or444
05-25-2010, 09:37 AM
hi,

i have a recored set that i want to delete a filed from it

Set rs = CurrentDb.OpenRecordset("test")
rs.Fields.Delete ("test1")

it does't work,

can any one help me ?

best ,
Or

boblarson
05-25-2010, 09:40 AM
Okay, first of all - are you meaning you want to delete this field from the table PERMANENTLY? Or do you just not want it in your recordset?

If you want it to remain in the table but not in the recordset then don't open the table as a recordset, use a QUERY to select only the fields you want.

or444
05-25-2010, 09:52 AM
Okay, first of all - are you meaning you want to delete this field from the table PERMANENTLY? Or do you just not want it in your recordset?

If you want it to remain in the table but not in the recordset then don't open the table as a recordset, use a QUERY to select only the fields you want.

hi,
the situation is this:

i have a table that i want to delete all of the Field in it
and then i need to create new Filed according to different input.

best,
Oron

JANR
05-25-2010, 10:48 PM
To empty a table from VBA why not use:

Currentdb.Execute "DELETE * FROM Test1"

JR

Galaxiom
05-26-2010, 12:04 AM
Your intent is still not clear.

If you want to get rid of the field entirely and add a new one with different attributes then you are changing the design of the table.

Firstly you will have to close the table before you can change its structure.
Then use ALTER TABLE SQL commands.

http://office.microsoft.com/en-us/access/HP010322071033.aspx

If you just want to put new values in an existing field then use an UPDATE statement to update the values in the field for the existing records.

JANR
05-26-2010, 12:13 AM
oops perhaps I sould read for more than 2 seconds worth.. :( I was thinking of empty a table for RECORDS and not altering the structure of the table... Sorry

JR