Reply
MS Access select and delete
Old 08-15-2006, 08:45 AM MS Access select and delete
Novice Talker

Posts: 10
Name: Daion Doroga
Hi
I am a new member and very new to database. I am having problem with MS Access data base. Example my text is "xyz" in a text field, txtField. Is there any way to run a query to delete x and z so I am left with y only. Can anyone help please...

Regards
__________________
http://www.cybersoftdesigns.com

Affordable web design, web application development, content management systems and ecommerce solutions for small business
daiondoroga is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 08-15-2006, 06:48 PM Re: MS Access select and delete
chrishirst's Avatar
Super Moderator

Latest Blog Post:
Am I impressed or what?
Posts: 14,831
Location: Blackpool. UK
not in a single query,

you would need to read the data, process it in some code or other, then update the database record with the new data.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-15-2006, 10:23 PM Re: MS Access select and delete
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
In a single text field, it would be possible. The problem is before the query, you'd have to do some sort of manipulation.
Code:
Dim Delete_1, Delete_2
Delete_1 = Mid (your form field, 1, 1)
Delete_2 = Mid (your form field, 3, 1)
SQL_Query = "Delete from (table) where (field) In ('" & Delete_1 & "', '" & Delete_2 & "')
Conn.Execute (SQL_Query)
That's rough code. Very rough code. Play with it and make it better, but it's the rough idea.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-16-2006, 04:11 AM Re: MS Access select and delete
chrishirst's Avatar
Super Moderator

Latest Blog Post:
Am I impressed or what?
Posts: 14,831
Location: Blackpool. UK
Adam, your query would delete records where the field contained the values of Delete_1 or Delete_2 would it not.

It seemed to me that the OP wants to do string manipulation within the SQL Server (Access) context. Which would need stored procedures to accomplish in a single query.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-16-2006, 11:55 AM Re: MS Access select and delete
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
That's exactly what it would do. It would delete those two values, which would have to be extracted from the text field.

As far as SPs used to accomplish this in a query...I'm not that good with them so I really wouldn't know. The easiest way I could personally see to do it is ASP string manipulation.

Mind you, a little more clarification is probably in order at this point. diaondoroga, what exactly did you want to accomplish?
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to MS Access select and delete
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13372 seconds with 12 queries