473,508 Members | 2,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to update a field in database..?

5 New Member
hai to all....!!
i want to upade a field in database.
iam using msaccess.
i know update query.
i have a field like this.
"D:\sample\test\new folder"

now i want to change the field like this.
D:\sample\aaaaaa\new folder

i want to change "test" as "aaaaaa"
is it posible to update a perticular part in a string?
i mean without updating the total filed, i want to update a perticular letters in that field.

please help me.
thank u very much.
Jan 25 '08 #1
6 2012
jyoung2
32 New Member
Is it always the same letters that need replacing and what are they being replaced to? Is that always the same. Where is that info stored.

You can use an iif statement in a query with the instring "instr" expression, but if it is something that is not exactly the same each time it would get more complicated.
Jan 25 '08 #2
Delerna
1,134 Recognized Expert Top Contributor
Here is your fields value
"D:\sample\test\new folder"


In your update query you can update it like this
Replace(FieldName,"test","aaaaaa")

of course jyoung2's comments on changing text that varies still applies
Jan 25 '08 #3
keerthisreenu
5 New Member
Here is your fields value
"D:\sample\test\new folder"


In your update query you can update it like this
Replace(FieldName,"test","aaaaaa")

of course jyoung2's comments on changing text that varies still applies
hai delerna...!
thank u very much for ur reply....
ok. this solution useful to me.
but my problem is i dont want to replace all fields which have "test".
suppose i have the fields in the table like this.
D:\sample\test\new folder
D:\sample\test
D:\sample\test\abcd
D:\sample\test\new folder\test\ewew


i want the output like this...
D:\sample\AAAA\new folder
D:\sample\AAAA
D:\sample\AAAA\abcd
D:\sample\AAAA\new folder\test\ewew


in the last filed it has another string "test".
D:\sample\test\new folder\test\ewew
i want to change the first test only.
D:\sample\AAAA\new folder\test\ewew

if i used Replace(FieldName,"test","aaaaaa") it replaces all test's in field.
but i want to replace first test only.
Jan 26 '08 #4
jyoung2
32 New Member
you could expand your replace
D:\sample\test\

Replace(FieldName,"D:\sample\test\","D:\sample\AAA A\")

thedn it would replace the whole section. Alot of this depends on this gets populated but this would change the first test only



hai delerna...!
thank u very much for ur reply....
ok. this solution useful to me.
but my problem is i dont want to replace all fields which have "test".
suppose i have the fields in the table like this.
D:\sample\test\new folder
D:\sample\test
D:\sample\test\abcd
D:\sample\test\new folder\test\ewew


i want the output like this...
D:\sample\AAAA\new folder
D:\sample\AAAA
D:\sample\AAAA\abcd
D:\sample\AAAA\new folder\test\ewew


in the last filed it has another string "test".
D:\sample\test\new folder\test\ewew
i want to change the first test only.
D:\sample\AAAA\new folder\test\ewew

if i used Replace(FieldName,"test","aaaaaa") it replaces all test's in field.
but i want to replace first test only.
Jan 26 '08 #5
Delerna
1,134 Recognized Expert Top Contributor
Agree with Jyoung2. It all depends on how structured your strings are. Your strings appear to always following a structure D:\sample\test\............

If however you had
D:\AnotherFolder\test\new folder\test\ewew

I don't know off-hand if access has the function CHARINDEX() but I guess it would have something similar. I don't have access available at the moment

CHARINDEX returns the position within a string of the first occurrence of another string
So CHARINDEX("D:\AnotherFolder\test\new folder\test\ewew","test")

would return 17. You could then use some string manipulation magic to retrieve
everything to the left of 'test' and everything to the right.
Then you can concatenate LeftSide & "Replacement Text" & RightSide
Jan 26 '08 #6
Delerna
1,134 Recognized Expert Top Contributor
just put "ms access charindex" into google and it appears that
INSTR() is the access equivalent of CHARINDEX()
Jan 26 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
5328
by: Jim S. | last post by:
I'm having a horrible time simply inserting the date in a MySQL database through a Visual Basic program. I have a table, called "ORDERS"; "ID" is the primary key. I'm trying the insert the date,...
3
12950
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
13
2632
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
3
1864
by: Larry Woods | last post by:
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is...
2
19558
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
16
3460
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
2
3082
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
13
2427
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
2
1381
by: somacore | last post by:
Hello all, I am trying to implement a trigger on a Microsoft SQL Server 2000 database. I have created the trigger, and it works mostly like it should, however I have a slight problem I can't seem...
4
7762
by: hapnendad | last post by:
In the question statement below Field names are in and variables are in (). All fields referenced are in what I have named the ‘PAR’ Table. Using MS Access 2003, I am working on a project...
0
7323
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,...
1
7039
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...
0
5626
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,...
1
5050
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...
0
4706
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
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
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
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.